avo-cli 4.2.0.beta.1 → 4.2.0.beta.3
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.
- checksums.yaml +4 -4
- data/README.md +22 -15
- data/avo-cli.gemspec +2 -2
- data/lib/avo/cli/version.rb +1 -1
- data/payload/README.md +22 -15
- data/payload/dist/base-command.js +1 -1
- data/payload/dist/client.js +4 -3
- data/payload/dist/commands/login.js +3 -3
- data/payload/dist/commands/schema.js +2 -2
- data/payload/dist/config.js +5 -3
- data/payload/oclif.manifest.json +11 -11
- data/payload/package.json +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 80f98f637e3c8fdcf98240d286c5fba151033e1333fd4aa49ddd3d0b4d25ddad
|
|
4
|
+
data.tar.gz: 6326d242760f69de8421da87b7b87c45ddd78737bb689fc8a0a8002a0a77fc36
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4673f8787bbc91a3fdb3c35e70ef06154d528578896ef93261d9205d18396aac2503a378f226da78e510a15a384a7ab707fdae1280d7209fea359bdeb5a2509f
|
|
7
|
+
data.tar.gz: d479b7cc761f23cd443e7aae09209e4856868e3ae1c77214e4c58f38e702fe641c2f1d368775b33a511ae92459b2719a1d0c8790c94fa62ad84e733bc02661e0
|
data/README.md
CHANGED
|
@@ -45,17 +45,24 @@ avo logout # deletes what was saved
|
|
|
45
45
|
set, `%LOCALAPPDATA%\avo` on Windows), readable by your user only. The token is
|
|
46
46
|
stored as plain text, like `~/.bundle/config`, so use a token you can revoke.
|
|
47
47
|
|
|
48
|
+
The host is the API base URL: the address `avo-api` answers on, mount path
|
|
49
|
+
included, exactly what you would paste into Postman before `/resources/...`.
|
|
50
|
+
An app that mounts it the usual way is `http://localhost:3000/api`; one that
|
|
51
|
+
mounts it elsewhere, say `mount_avo_api at: "avo"`, is
|
|
52
|
+
`http://localhost:3000/avo`. The CLI appends only `/resources/<version>/<path>`
|
|
53
|
+
and guesses no mount, so the address that works in a browser works here.
|
|
54
|
+
|
|
48
55
|
For CI and scripts, skip `login` and set the variables. A flag wins over its
|
|
49
56
|
variable, and either wins over what was saved. The saved host and token are
|
|
50
57
|
used only together: name a host or a token yourself and the saved pair is left
|
|
51
58
|
out, so a saved token never reaches another host. The saved API version goes
|
|
52
59
|
with them: `avo login --api-version v2` once, and later commands use `v2`.
|
|
53
60
|
|
|
54
|
-
| Variable | Flag | Default | Purpose
|
|
55
|
-
| ----------------- | --------------- | ------- |
|
|
56
|
-
| `AVO_API_HOST` | `--host` | none |
|
|
57
|
-
| `AVO_API_TOKEN` | `--token` | none | API token secret, sent as `Authorization: Bearer`
|
|
58
|
-
| `AVO_API_VERSION` | `--api-version` | `v1` | API version segment of the URL, saved by `login`
|
|
61
|
+
| Variable | Flag | Default | Purpose |
|
|
62
|
+
| ----------------- | --------------- | ------- | ------------------------------------------------------------------- |
|
|
63
|
+
| `AVO_API_HOST` | `--host` | none | API base URL, mount path included, e.g. `http://localhost:3000/api` |
|
|
64
|
+
| `AVO_API_TOKEN` | `--token` | none | API token secret, sent as `Authorization: Bearer` |
|
|
65
|
+
| `AVO_API_VERSION` | `--api-version` | `v1` | API version segment of the URL, saved by `login` |
|
|
59
66
|
|
|
60
67
|
## Commands
|
|
61
68
|
|
|
@@ -281,7 +288,7 @@ FLAGS
|
|
|
281
288
|
CONNECTION FLAGS
|
|
282
289
|
--api-version=<value> [env: AVO_API_VERSION] API version segment of the URL; defaults to the one `avo login` saved,
|
|
283
290
|
then v1
|
|
284
|
-
--host=<value> [env: AVO_API_HOST]
|
|
291
|
+
--host=<value> [env: AVO_API_HOST] API base URL, including the mount path, e.g. http://localhost:3000/api
|
|
285
292
|
--token=<value> [env: AVO_API_TOKEN] API token secret, sent as a Bearer token
|
|
286
293
|
|
|
287
294
|
OUTPUT FLAGS
|
|
@@ -323,7 +330,7 @@ ARGUMENTS
|
|
|
323
330
|
CONNECTION FLAGS
|
|
324
331
|
--api-version=<value> [env: AVO_API_VERSION] API version segment of the URL; defaults to the one `avo login` saved,
|
|
325
332
|
then v1
|
|
326
|
-
--host=<value> [env: AVO_API_HOST]
|
|
333
|
+
--host=<value> [env: AVO_API_HOST] API base URL, including the mount path, e.g. http://localhost:3000/api
|
|
327
334
|
--token=<value> [env: AVO_API_TOKEN] API token secret, sent as a Bearer token
|
|
328
335
|
|
|
329
336
|
OUTPUT FLAGS
|
|
@@ -356,7 +363,7 @@ ARGUMENTS
|
|
|
356
363
|
CONNECTION FLAGS
|
|
357
364
|
--api-version=<value> [env: AVO_API_VERSION] API version segment of the URL; defaults to the one `avo login` saved,
|
|
358
365
|
then v1
|
|
359
|
-
--host=<value> [env: AVO_API_HOST]
|
|
366
|
+
--host=<value> [env: AVO_API_HOST] API base URL, including the mount path, e.g. http://localhost:3000/api
|
|
360
367
|
--token=<value> [env: AVO_API_TOKEN] API token secret, sent as a Bearer token
|
|
361
368
|
|
|
362
369
|
OUTPUT FLAGS
|
|
@@ -415,7 +422,7 @@ FLAGS
|
|
|
415
422
|
CONNECTION FLAGS
|
|
416
423
|
--api-version=<value> [env: AVO_API_VERSION] API version segment of the URL; defaults to the one `avo login` saved,
|
|
417
424
|
then v1
|
|
418
|
-
--host=<value> [env: AVO_API_HOST]
|
|
425
|
+
--host=<value> [env: AVO_API_HOST] API base URL, including the mount path, e.g. http://localhost:3000/api
|
|
419
426
|
--token=<value> [env: AVO_API_TOKEN] API token secret, sent as a Bearer token
|
|
420
427
|
|
|
421
428
|
OUTPUT FLAGS
|
|
@@ -450,7 +457,7 @@ USAGE
|
|
|
450
457
|
CONNECTION FLAGS
|
|
451
458
|
--api-version=<value> [env: AVO_API_VERSION] API version segment of the URL; defaults to the one `avo login` saved,
|
|
452
459
|
then v1
|
|
453
|
-
--host=<value> [env: AVO_API_HOST]
|
|
460
|
+
--host=<value> [env: AVO_API_HOST] API base URL, including the mount path, e.g. http://localhost:3000/api
|
|
454
461
|
--token=<value> [env: AVO_API_TOKEN] API token secret, sent as a Bearer token
|
|
455
462
|
|
|
456
463
|
OUTPUT FLAGS
|
|
@@ -462,9 +469,9 @@ DESCRIPTION
|
|
|
462
469
|
EXAMPLES
|
|
463
470
|
$ avo login
|
|
464
471
|
|
|
465
|
-
$ avo login --host http://localhost:3000
|
|
472
|
+
$ avo login --host http://localhost:3000/api
|
|
466
473
|
|
|
467
|
-
$ avo login --host http://localhost:3000 --token avo_...
|
|
474
|
+
$ avo login --host http://localhost:3000/api --token avo_...
|
|
468
475
|
|
|
469
476
|
$ avo login --api-version v2
|
|
470
477
|
```
|
|
@@ -503,7 +510,7 @@ FLAGS
|
|
|
503
510
|
CONNECTION FLAGS
|
|
504
511
|
--api-version=<value> [env: AVO_API_VERSION] API version segment of the URL; defaults to the one `avo login` saved,
|
|
505
512
|
then v1
|
|
506
|
-
--host=<value> [env: AVO_API_HOST]
|
|
513
|
+
--host=<value> [env: AVO_API_HOST] API base URL, including the mount path, e.g. http://localhost:3000/api
|
|
507
514
|
--token=<value> [env: AVO_API_TOKEN] API token secret, sent as a Bearer token
|
|
508
515
|
|
|
509
516
|
OUTPUT FLAGS
|
|
@@ -523,7 +530,7 @@ EXAMPLES
|
|
|
523
530
|
|
|
524
531
|
$ avo schema users --view show
|
|
525
532
|
|
|
526
|
-
$ avo schema --host http://localhost:3000 --token avo_...
|
|
533
|
+
$ avo schema --host http://localhost:3000/api --token avo_...
|
|
527
534
|
```
|
|
528
535
|
|
|
529
536
|
## `avo update RESOURCE ID`
|
|
@@ -545,7 +552,7 @@ FLAGS
|
|
|
545
552
|
CONNECTION FLAGS
|
|
546
553
|
--api-version=<value> [env: AVO_API_VERSION] API version segment of the URL; defaults to the one `avo login` saved,
|
|
547
554
|
then v1
|
|
548
|
-
--host=<value> [env: AVO_API_HOST]
|
|
555
|
+
--host=<value> [env: AVO_API_HOST] API base URL, including the mount path, e.g. http://localhost:3000/api
|
|
549
556
|
--token=<value> [env: AVO_API_TOKEN] API token secret, sent as a Bearer token
|
|
550
557
|
|
|
551
558
|
OUTPUT FLAGS
|
data/avo-cli.gemspec
CHANGED
|
@@ -18,8 +18,8 @@ Gem::Specification.new do |spec|
|
|
|
18
18
|
spec.bindir = "exe"
|
|
19
19
|
spec.executables = ["avo"]
|
|
20
20
|
|
|
21
|
-
# payload/ is gitignored and picked up from disk at pack time.
|
|
22
|
-
#
|
|
21
|
+
# payload/ is gitignored and picked up from disk at pack time. `ws release` runs bin/build_payload in its own phase
|
|
22
|
+
# just before the build; run it by hand before packing this yourself. See docs/distribution.md.
|
|
23
23
|
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
|
24
24
|
Dir["{exe,lib,payload}/**/*", "README.md", "avo-cli.gemspec"]
|
|
25
25
|
.reject { |f| File.symlink?(File.expand_path(f)) }
|
data/lib/avo/cli/version.rb
CHANGED
data/payload/README.md
CHANGED
|
@@ -45,17 +45,24 @@ avo logout # deletes what was saved
|
|
|
45
45
|
set, `%LOCALAPPDATA%\avo` on Windows), readable by your user only. The token is
|
|
46
46
|
stored as plain text, like `~/.bundle/config`, so use a token you can revoke.
|
|
47
47
|
|
|
48
|
+
The host is the API base URL: the address `avo-api` answers on, mount path
|
|
49
|
+
included, exactly what you would paste into Postman before `/resources/...`.
|
|
50
|
+
An app that mounts it the usual way is `http://localhost:3000/api`; one that
|
|
51
|
+
mounts it elsewhere, say `mount_avo_api at: "avo"`, is
|
|
52
|
+
`http://localhost:3000/avo`. The CLI appends only `/resources/<version>/<path>`
|
|
53
|
+
and guesses no mount, so the address that works in a browser works here.
|
|
54
|
+
|
|
48
55
|
For CI and scripts, skip `login` and set the variables. A flag wins over its
|
|
49
56
|
variable, and either wins over what was saved. The saved host and token are
|
|
50
57
|
used only together: name a host or a token yourself and the saved pair is left
|
|
51
58
|
out, so a saved token never reaches another host. The saved API version goes
|
|
52
59
|
with them: `avo login --api-version v2` once, and later commands use `v2`.
|
|
53
60
|
|
|
54
|
-
| Variable | Flag | Default | Purpose
|
|
55
|
-
| ----------------- | --------------- | ------- |
|
|
56
|
-
| `AVO_API_HOST` | `--host` | none |
|
|
57
|
-
| `AVO_API_TOKEN` | `--token` | none | API token secret, sent as `Authorization: Bearer`
|
|
58
|
-
| `AVO_API_VERSION` | `--api-version` | `v1` | API version segment of the URL, saved by `login`
|
|
61
|
+
| Variable | Flag | Default | Purpose |
|
|
62
|
+
| ----------------- | --------------- | ------- | ------------------------------------------------------------------- |
|
|
63
|
+
| `AVO_API_HOST` | `--host` | none | API base URL, mount path included, e.g. `http://localhost:3000/api` |
|
|
64
|
+
| `AVO_API_TOKEN` | `--token` | none | API token secret, sent as `Authorization: Bearer` |
|
|
65
|
+
| `AVO_API_VERSION` | `--api-version` | `v1` | API version segment of the URL, saved by `login` |
|
|
59
66
|
|
|
60
67
|
## Commands
|
|
61
68
|
|
|
@@ -281,7 +288,7 @@ FLAGS
|
|
|
281
288
|
CONNECTION FLAGS
|
|
282
289
|
--api-version=<value> [env: AVO_API_VERSION] API version segment of the URL; defaults to the one `avo login` saved,
|
|
283
290
|
then v1
|
|
284
|
-
--host=<value> [env: AVO_API_HOST]
|
|
291
|
+
--host=<value> [env: AVO_API_HOST] API base URL, including the mount path, e.g. http://localhost:3000/api
|
|
285
292
|
--token=<value> [env: AVO_API_TOKEN] API token secret, sent as a Bearer token
|
|
286
293
|
|
|
287
294
|
OUTPUT FLAGS
|
|
@@ -323,7 +330,7 @@ ARGUMENTS
|
|
|
323
330
|
CONNECTION FLAGS
|
|
324
331
|
--api-version=<value> [env: AVO_API_VERSION] API version segment of the URL; defaults to the one `avo login` saved,
|
|
325
332
|
then v1
|
|
326
|
-
--host=<value> [env: AVO_API_HOST]
|
|
333
|
+
--host=<value> [env: AVO_API_HOST] API base URL, including the mount path, e.g. http://localhost:3000/api
|
|
327
334
|
--token=<value> [env: AVO_API_TOKEN] API token secret, sent as a Bearer token
|
|
328
335
|
|
|
329
336
|
OUTPUT FLAGS
|
|
@@ -356,7 +363,7 @@ ARGUMENTS
|
|
|
356
363
|
CONNECTION FLAGS
|
|
357
364
|
--api-version=<value> [env: AVO_API_VERSION] API version segment of the URL; defaults to the one `avo login` saved,
|
|
358
365
|
then v1
|
|
359
|
-
--host=<value> [env: AVO_API_HOST]
|
|
366
|
+
--host=<value> [env: AVO_API_HOST] API base URL, including the mount path, e.g. http://localhost:3000/api
|
|
360
367
|
--token=<value> [env: AVO_API_TOKEN] API token secret, sent as a Bearer token
|
|
361
368
|
|
|
362
369
|
OUTPUT FLAGS
|
|
@@ -415,7 +422,7 @@ FLAGS
|
|
|
415
422
|
CONNECTION FLAGS
|
|
416
423
|
--api-version=<value> [env: AVO_API_VERSION] API version segment of the URL; defaults to the one `avo login` saved,
|
|
417
424
|
then v1
|
|
418
|
-
--host=<value> [env: AVO_API_HOST]
|
|
425
|
+
--host=<value> [env: AVO_API_HOST] API base URL, including the mount path, e.g. http://localhost:3000/api
|
|
419
426
|
--token=<value> [env: AVO_API_TOKEN] API token secret, sent as a Bearer token
|
|
420
427
|
|
|
421
428
|
OUTPUT FLAGS
|
|
@@ -450,7 +457,7 @@ USAGE
|
|
|
450
457
|
CONNECTION FLAGS
|
|
451
458
|
--api-version=<value> [env: AVO_API_VERSION] API version segment of the URL; defaults to the one `avo login` saved,
|
|
452
459
|
then v1
|
|
453
|
-
--host=<value> [env: AVO_API_HOST]
|
|
460
|
+
--host=<value> [env: AVO_API_HOST] API base URL, including the mount path, e.g. http://localhost:3000/api
|
|
454
461
|
--token=<value> [env: AVO_API_TOKEN] API token secret, sent as a Bearer token
|
|
455
462
|
|
|
456
463
|
OUTPUT FLAGS
|
|
@@ -462,9 +469,9 @@ DESCRIPTION
|
|
|
462
469
|
EXAMPLES
|
|
463
470
|
$ avo login
|
|
464
471
|
|
|
465
|
-
$ avo login --host http://localhost:3000
|
|
472
|
+
$ avo login --host http://localhost:3000/api
|
|
466
473
|
|
|
467
|
-
$ avo login --host http://localhost:3000 --token avo_...
|
|
474
|
+
$ avo login --host http://localhost:3000/api --token avo_...
|
|
468
475
|
|
|
469
476
|
$ avo login --api-version v2
|
|
470
477
|
```
|
|
@@ -503,7 +510,7 @@ FLAGS
|
|
|
503
510
|
CONNECTION FLAGS
|
|
504
511
|
--api-version=<value> [env: AVO_API_VERSION] API version segment of the URL; defaults to the one `avo login` saved,
|
|
505
512
|
then v1
|
|
506
|
-
--host=<value> [env: AVO_API_HOST]
|
|
513
|
+
--host=<value> [env: AVO_API_HOST] API base URL, including the mount path, e.g. http://localhost:3000/api
|
|
507
514
|
--token=<value> [env: AVO_API_TOKEN] API token secret, sent as a Bearer token
|
|
508
515
|
|
|
509
516
|
OUTPUT FLAGS
|
|
@@ -523,7 +530,7 @@ EXAMPLES
|
|
|
523
530
|
|
|
524
531
|
$ avo schema users --view show
|
|
525
532
|
|
|
526
|
-
$ avo schema --host http://localhost:3000 --token avo_...
|
|
533
|
+
$ avo schema --host http://localhost:3000/api --token avo_...
|
|
527
534
|
```
|
|
528
535
|
|
|
529
536
|
## `avo update RESOURCE ID`
|
|
@@ -545,7 +552,7 @@ FLAGS
|
|
|
545
552
|
CONNECTION FLAGS
|
|
546
553
|
--api-version=<value> [env: AVO_API_VERSION] API version segment of the URL; defaults to the one `avo login` saved,
|
|
547
554
|
then v1
|
|
548
|
-
--host=<value> [env: AVO_API_HOST]
|
|
555
|
+
--host=<value> [env: AVO_API_HOST] API base URL, including the mount path, e.g. http://localhost:3000/api
|
|
549
556
|
--token=<value> [env: AVO_API_TOKEN] API token secret, sent as a Bearer token
|
|
550
557
|
|
|
551
558
|
OUTPUT FLAGS
|
|
@@ -13,7 +13,7 @@ export class ConnectionCommand extends Command {
|
|
|
13
13
|
helpGroup: 'CONNECTION',
|
|
14
14
|
}),
|
|
15
15
|
host: Flags.string({
|
|
16
|
-
description: '
|
|
16
|
+
description: 'API base URL, including the mount path, e.g. http://localhost:3000/api',
|
|
17
17
|
env: 'AVO_API_HOST',
|
|
18
18
|
helpGroup: 'CONNECTION',
|
|
19
19
|
}),
|
data/payload/dist/client.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { failedRequest, failedResponse } from './errors.js';
|
|
2
2
|
const DEFAULT_TIMEOUT_MS = 30_000;
|
|
3
|
-
// All the CLI knows about avo-api: the URL shape
|
|
4
|
-
//
|
|
3
|
+
// All the CLI knows about avo-api: the URL shape `<host>/resources/<version>/<path>`, a Bearer token, and JSON both
|
|
4
|
+
// ways. The host is the API base URL and carries the mount, so an app that mounts avo-api anywhere is reached by
|
|
5
|
+
// naming that mount rather than by the CLI guessing one.
|
|
5
6
|
export class Client {
|
|
6
7
|
options;
|
|
7
8
|
constructor(options) {
|
|
@@ -53,7 +54,7 @@ export class Client {
|
|
|
53
54
|
}
|
|
54
55
|
url(path, query) {
|
|
55
56
|
const segments = path.map((segment) => encodeURIComponent(segment)).join('/');
|
|
56
|
-
const url = new URL(`${this.options.host}/
|
|
57
|
+
const url = new URL(`${this.options.host}/resources/${this.options.apiVersion}/${segments}`);
|
|
57
58
|
for (const [key, value] of Object.entries(query ?? {})) {
|
|
58
59
|
if (value !== undefined)
|
|
59
60
|
url.searchParams.set(key, String(value));
|
|
@@ -9,8 +9,8 @@ export default class Login extends ConnectionCommand {
|
|
|
9
9
|
static description = 'Save a host, an API token and the API version, so later commands need none of them';
|
|
10
10
|
static examples = [
|
|
11
11
|
'<%= config.bin %> login',
|
|
12
|
-
'<%= config.bin %> login --host http://localhost:3000',
|
|
13
|
-
'<%= config.bin %> login --host http://localhost:3000 --token avo_...',
|
|
12
|
+
'<%= config.bin %> login --host http://localhost:3000/api',
|
|
13
|
+
'<%= config.bin %> login --host http://localhost:3000/api --token avo_...',
|
|
14
14
|
'<%= config.bin %> login --api-version v2',
|
|
15
15
|
];
|
|
16
16
|
// On stderr, like any prompt: `avo login > log` still shows the questions, and the log gets only the result.
|
|
@@ -33,7 +33,7 @@ export default class Login extends ConnectionCommand {
|
|
|
33
33
|
this.requireTerminal('host', '--host', 'AVO_API_HOST');
|
|
34
34
|
// Normalized with the rest in `resolveConfig`; the prompt has already accepted it.
|
|
35
35
|
return Login.prompts.input({
|
|
36
|
-
message: '
|
|
36
|
+
message: 'API base URL (e.g. http://localhost:3000/api):',
|
|
37
37
|
validate: problemWith(normalizeHost),
|
|
38
38
|
});
|
|
39
39
|
}
|
|
@@ -17,7 +17,7 @@ export default class Schema extends BaseCommand {
|
|
|
17
17
|
'<%= config.bin %> schema --format json',
|
|
18
18
|
'<%= config.bin %> schema users',
|
|
19
19
|
'<%= config.bin %> schema users --view show',
|
|
20
|
-
'<%= config.bin %> schema --host http://localhost:3000 --token avo_...',
|
|
20
|
+
'<%= config.bin %> schema --host http://localhost:3000/api --token avo_...',
|
|
21
21
|
];
|
|
22
22
|
static flags = {
|
|
23
23
|
// No `options`: the view names are the API's to know, not this flag's.
|
|
@@ -53,6 +53,6 @@ export default class Schema extends BaseCommand {
|
|
|
53
53
|
this.log(`No resources: nothing API ${schema.api_version} serves is within this token's entitlements.`);
|
|
54
54
|
return;
|
|
55
55
|
}
|
|
56
|
-
this.log(renderTable(schema.resources, ['route_key', 'name', 'entitlements'
|
|
56
|
+
this.log(renderTable(schema.resources, ['route_key', 'name', 'entitlements']));
|
|
57
57
|
}
|
|
58
58
|
}
|
data/payload/dist/config.js
CHANGED
|
@@ -14,7 +14,8 @@ export function resolveConfig(flags, configDir) {
|
|
|
14
14
|
throw CliError.usage(ignoredSaved()
|
|
15
15
|
? 'No host. The saved login was ignored because a token was given without a host. Pass --host or set ' +
|
|
16
16
|
'AVO_API_HOST too, or drop --token and unset AVO_API_TOKEN to use the saved login.'
|
|
17
|
-
: 'No host. Pass --host (e.g.
|
|
17
|
+
: 'No host. The host is the API base URL, mount path included. Pass --host (e.g. ' +
|
|
18
|
+
'http://localhost:3000/api), set AVO_API_HOST, or run `avo login`.');
|
|
18
19
|
}
|
|
19
20
|
if (!token) {
|
|
20
21
|
throw CliError.usage(ignoredSaved()
|
|
@@ -37,14 +38,15 @@ export function checkToken(token) {
|
|
|
37
38
|
}
|
|
38
39
|
}
|
|
39
40
|
// A scheme is required rather than assumed: `localhost:3000` parses as a URL with protocol `localhost:`, and guessing
|
|
40
|
-
// http would hide the mistake until the request failed.
|
|
41
|
+
// http would hide the mistake until the request failed. The path is kept, since it is where avo-api is mounted; a
|
|
42
|
+
// trailing slash is dropped so the rest of the URL appends cleanly.
|
|
41
43
|
export function normalizeHost(host) {
|
|
42
44
|
let url;
|
|
43
45
|
try {
|
|
44
46
|
url = new URL(host);
|
|
45
47
|
}
|
|
46
48
|
catch {
|
|
47
|
-
throw CliError.usage(`Host must be a URL, e.g. http://localhost:3000 (got "${host}")`);
|
|
49
|
+
throw CliError.usage(`Host must be a URL, e.g. http://localhost:3000/api (got "${host}")`);
|
|
48
50
|
}
|
|
49
51
|
if (url.protocol !== 'http:' && url.protocol !== 'https:') {
|
|
50
52
|
throw CliError.usage(`Host must start with http:// or https:// (got "${host}")`);
|
data/payload/oclif.manifest.json
CHANGED
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"type": "option"
|
|
30
30
|
},
|
|
31
31
|
"host": {
|
|
32
|
-
"description": "
|
|
32
|
+
"description": "API base URL, including the mount path, e.g. http://localhost:3000/api",
|
|
33
33
|
"env": "AVO_API_HOST",
|
|
34
34
|
"helpGroup": "CONNECTION",
|
|
35
35
|
"name": "host",
|
|
@@ -153,7 +153,7 @@
|
|
|
153
153
|
"type": "option"
|
|
154
154
|
},
|
|
155
155
|
"host": {
|
|
156
|
-
"description": "
|
|
156
|
+
"description": "API base URL, including the mount path, e.g. http://localhost:3000/api",
|
|
157
157
|
"env": "AVO_API_HOST",
|
|
158
158
|
"helpGroup": "CONNECTION",
|
|
159
159
|
"name": "host",
|
|
@@ -259,7 +259,7 @@
|
|
|
259
259
|
"type": "option"
|
|
260
260
|
},
|
|
261
261
|
"host": {
|
|
262
|
-
"description": "
|
|
262
|
+
"description": "API base URL, including the mount path, e.g. http://localhost:3000/api",
|
|
263
263
|
"env": "AVO_API_HOST",
|
|
264
264
|
"helpGroup": "CONNECTION",
|
|
265
265
|
"name": "host",
|
|
@@ -371,7 +371,7 @@
|
|
|
371
371
|
"type": "option"
|
|
372
372
|
},
|
|
373
373
|
"host": {
|
|
374
|
-
"description": "
|
|
374
|
+
"description": "API base URL, including the mount path, e.g. http://localhost:3000/api",
|
|
375
375
|
"env": "AVO_API_HOST",
|
|
376
376
|
"helpGroup": "CONNECTION",
|
|
377
377
|
"name": "host",
|
|
@@ -492,8 +492,8 @@
|
|
|
492
492
|
"description": "Save a host, an API token and the API version, so later commands need none of them",
|
|
493
493
|
"examples": [
|
|
494
494
|
"<%= config.bin %> login",
|
|
495
|
-
"<%= config.bin %> login --host http://localhost:3000",
|
|
496
|
-
"<%= config.bin %> login --host http://localhost:3000 --token avo_...",
|
|
495
|
+
"<%= config.bin %> login --host http://localhost:3000/api",
|
|
496
|
+
"<%= config.bin %> login --host http://localhost:3000/api --token avo_...",
|
|
497
497
|
"<%= config.bin %> login --api-version v2"
|
|
498
498
|
],
|
|
499
499
|
"flags": {
|
|
@@ -507,7 +507,7 @@
|
|
|
507
507
|
"type": "option"
|
|
508
508
|
},
|
|
509
509
|
"host": {
|
|
510
|
-
"description": "
|
|
510
|
+
"description": "API base URL, including the mount path, e.g. http://localhost:3000/api",
|
|
511
511
|
"env": "AVO_API_HOST",
|
|
512
512
|
"helpGroup": "CONNECTION",
|
|
513
513
|
"name": "host",
|
|
@@ -585,7 +585,7 @@
|
|
|
585
585
|
"<%= config.bin %> schema --format json",
|
|
586
586
|
"<%= config.bin %> schema users",
|
|
587
587
|
"<%= config.bin %> schema users --view show",
|
|
588
|
-
"<%= config.bin %> schema --host http://localhost:3000 --token avo_..."
|
|
588
|
+
"<%= config.bin %> schema --host http://localhost:3000/api --token avo_..."
|
|
589
589
|
],
|
|
590
590
|
"flags": {
|
|
591
591
|
"api-version": {
|
|
@@ -598,7 +598,7 @@
|
|
|
598
598
|
"type": "option"
|
|
599
599
|
},
|
|
600
600
|
"host": {
|
|
601
|
-
"description": "
|
|
601
|
+
"description": "API base URL, including the mount path, e.g. http://localhost:3000/api",
|
|
602
602
|
"env": "AVO_API_HOST",
|
|
603
603
|
"helpGroup": "CONNECTION",
|
|
604
604
|
"name": "host",
|
|
@@ -694,7 +694,7 @@
|
|
|
694
694
|
"type": "option"
|
|
695
695
|
},
|
|
696
696
|
"host": {
|
|
697
|
-
"description": "
|
|
697
|
+
"description": "API base URL, including the mount path, e.g. http://localhost:3000/api",
|
|
698
698
|
"env": "AVO_API_HOST",
|
|
699
699
|
"helpGroup": "CONNECTION",
|
|
700
700
|
"name": "host",
|
|
@@ -789,5 +789,5 @@
|
|
|
789
789
|
]
|
|
790
790
|
}
|
|
791
791
|
},
|
|
792
|
-
"version": "4.2.0.beta.
|
|
792
|
+
"version": "4.2.0.beta.3"
|
|
793
793
|
}
|
data/payload/package.json
CHANGED