avo-cli 0.0.3 → 4.2.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.
- checksums.yaml +4 -4
- data/README.md +605 -0
- data/avo-cli.gemspec +22 -23
- data/exe/avo +6 -0
- data/lib/avo/cli/runner.rb +86 -0
- data/lib/avo/cli/version.rb +7 -0
- data/lib/avo-cli.rb +5 -0
- data/payload/README.md +605 -0
- data/payload/bin/run.cmd +3 -0
- data/payload/bin/run.js +5 -0
- data/payload/dist/base-command.js +60 -0
- data/payload/dist/client.js +77 -0
- data/payload/dist/commands/create.js +26 -0
- data/payload/dist/commands/delete.js +22 -0
- data/payload/dist/commands/get.js +19 -0
- data/payload/dist/commands/list.js +47 -0
- data/payload/dist/commands/login.js +93 -0
- data/payload/dist/commands/logout.js +13 -0
- data/payload/dist/commands/schema.js +58 -0
- data/payload/dist/commands/update.js +27 -0
- data/payload/dist/config.js +57 -0
- data/payload/dist/data.js +33 -0
- data/payload/dist/errors.js +93 -0
- data/payload/dist/hooks/command-not-found.js +22 -0
- data/payload/dist/index.js +1 -0
- data/payload/dist/list.js +7 -0
- data/payload/dist/payload.js +35 -0
- data/payload/dist/record-command.js +51 -0
- data/payload/dist/schema.js +29 -0
- data/payload/dist/store.js +91 -0
- data/payload/dist/suggest.js +29 -0
- data/payload/dist/table.js +40 -0
- data/payload/dist/write-command.js +26 -0
- data/payload/node_modules/@inquirer/ansi/LICENSE +22 -0
- data/payload/node_modules/@inquirer/ansi/README.md +89 -0
- data/payload/node_modules/@inquirer/ansi/dist/commonjs/index.d.ts +14 -0
- data/payload/node_modules/@inquirer/ansi/dist/commonjs/index.js +28 -0
- data/payload/node_modules/@inquirer/ansi/dist/commonjs/package.json +3 -0
- data/payload/node_modules/@inquirer/ansi/dist/esm/index.d.ts +14 -0
- data/payload/node_modules/@inquirer/ansi/dist/esm/index.js +21 -0
- data/payload/node_modules/@inquirer/ansi/dist/esm/package.json +3 -0
- data/payload/node_modules/@inquirer/ansi/package.json +97 -0
- data/payload/node_modules/@inquirer/core/LICENSE +22 -0
- data/payload/node_modules/@inquirer/core/README.md +383 -0
- data/payload/node_modules/@inquirer/core/dist/commonjs/index.d.ts +13 -0
- data/payload/node_modules/@inquirer/core/dist/commonjs/index.js +46 -0
- data/payload/node_modules/@inquirer/core/dist/commonjs/lib/Separator.d.ts +10 -0
- data/payload/node_modules/@inquirer/core/dist/commonjs/lib/Separator.js +28 -0
- data/payload/node_modules/@inquirer/core/dist/commonjs/lib/create-prompt.d.ts +4 -0
- data/payload/node_modules/@inquirer/core/dist/commonjs/lib/create-prompt.js +156 -0
- data/payload/node_modules/@inquirer/core/dist/commonjs/lib/errors.d.ts +20 -0
- data/payload/node_modules/@inquirer/core/dist/commonjs/lib/errors.js +29 -0
- data/payload/node_modules/@inquirer/core/dist/commonjs/lib/hook-engine.d.ts +23 -0
- data/payload/node_modules/@inquirer/core/dist/commonjs/lib/hook-engine.js +118 -0
- data/payload/node_modules/@inquirer/core/dist/commonjs/lib/key.d.ts +12 -0
- data/payload/node_modules/@inquirer/core/dist/commonjs/lib/key.js +29 -0
- data/payload/node_modules/@inquirer/core/dist/commonjs/lib/make-theme.d.ts +3 -0
- data/payload/node_modules/@inquirer/core/dist/commonjs/lib/make-theme.js +33 -0
- data/payload/node_modules/@inquirer/core/dist/commonjs/lib/pagination/use-pagination.d.ts +16 -0
- data/payload/node_modules/@inquirer/core/dist/commonjs/lib/pagination/use-pagination.js +124 -0
- data/payload/node_modules/@inquirer/core/dist/commonjs/lib/promise-polyfill.d.ts +7 -0
- data/payload/node_modules/@inquirer/core/dist/commonjs/lib/promise-polyfill.js +18 -0
- data/payload/node_modules/@inquirer/core/dist/commonjs/lib/screen-manager.d.ts +14 -0
- data/payload/node_modules/@inquirer/core/dist/commonjs/lib/screen-manager.js +82 -0
- data/payload/node_modules/@inquirer/core/dist/commonjs/lib/theme.d.ts +155 -0
- data/payload/node_modules/@inquirer/core/dist/commonjs/lib/theme.js +27 -0
- data/payload/node_modules/@inquirer/core/dist/commonjs/lib/use-effect.d.ts +2 -0
- data/payload/node_modules/@inquirer/core/dist/commonjs/lib/use-effect.js +14 -0
- data/payload/node_modules/@inquirer/core/dist/commonjs/lib/use-keypress.d.ts +3 -0
- data/payload/node_modules/@inquirer/core/dist/commonjs/lib/use-keypress.js +23 -0
- data/payload/node_modules/@inquirer/core/dist/commonjs/lib/use-memo.d.ts +1 -0
- data/payload/node_modules/@inquirer/core/dist/commonjs/lib/use-memo.js +17 -0
- data/payload/node_modules/@inquirer/core/dist/commonjs/lib/use-prefix.d.ts +5 -0
- data/payload/node_modules/@inquirer/core/dist/commonjs/lib/use-prefix.js +38 -0
- data/payload/node_modules/@inquirer/core/dist/commonjs/lib/use-ref.d.ts +6 -0
- data/payload/node_modules/@inquirer/core/dist/commonjs/lib/use-ref.js +7 -0
- data/payload/node_modules/@inquirer/core/dist/commonjs/lib/use-state.d.ts +4 -0
- data/payload/node_modules/@inquirer/core/dist/commonjs/lib/use-state.js +23 -0
- data/payload/node_modules/@inquirer/core/dist/commonjs/lib/utils.d.ts +13 -0
- data/payload/node_modules/@inquirer/core/dist/commonjs/lib/utils.js +32 -0
- data/payload/node_modules/@inquirer/core/dist/commonjs/package.json +3 -0
- data/payload/node_modules/@inquirer/core/dist/esm/index.d.ts +13 -0
- data/payload/node_modules/@inquirer/core/dist/esm/index.js +12 -0
- data/payload/node_modules/@inquirer/core/dist/esm/lib/Separator.d.ts +10 -0
- data/payload/node_modules/@inquirer/core/dist/esm/lib/Separator.js +21 -0
- data/payload/node_modules/@inquirer/core/dist/esm/lib/create-prompt.d.ts +4 -0
- data/payload/node_modules/@inquirer/core/dist/esm/lib/create-prompt.js +117 -0
- data/payload/node_modules/@inquirer/core/dist/esm/lib/errors.d.ts +20 -0
- data/payload/node_modules/@inquirer/core/dist/esm/lib/errors.js +21 -0
- data/payload/node_modules/@inquirer/core/dist/esm/lib/hook-engine.d.ts +23 -0
- data/payload/node_modules/@inquirer/core/dist/esm/lib/hook-engine.js +110 -0
- data/payload/node_modules/@inquirer/core/dist/esm/lib/key.d.ts +12 -0
- data/payload/node_modules/@inquirer/core/dist/esm/lib/key.js +19 -0
- data/payload/node_modules/@inquirer/core/dist/esm/lib/make-theme.d.ts +3 -0
- data/payload/node_modules/@inquirer/core/dist/esm/lib/make-theme.js +30 -0
- data/payload/node_modules/@inquirer/core/dist/esm/lib/pagination/use-pagination.d.ts +16 -0
- data/payload/node_modules/@inquirer/core/dist/esm/lib/pagination/use-pagination.js +121 -0
- data/payload/node_modules/@inquirer/core/dist/esm/lib/promise-polyfill.d.ts +7 -0
- data/payload/node_modules/@inquirer/core/dist/esm/lib/promise-polyfill.js +14 -0
- data/payload/node_modules/@inquirer/core/dist/esm/lib/screen-manager.d.ts +14 -0
- data/payload/node_modules/@inquirer/core/dist/esm/lib/screen-manager.js +79 -0
- data/payload/node_modules/@inquirer/core/dist/esm/lib/theme.d.ts +155 -0
- data/payload/node_modules/@inquirer/core/dist/esm/lib/theme.js +21 -0
- data/payload/node_modules/@inquirer/core/dist/esm/lib/use-effect.d.ts +2 -0
- data/payload/node_modules/@inquirer/core/dist/esm/lib/use-effect.js +11 -0
- data/payload/node_modules/@inquirer/core/dist/esm/lib/use-keypress.d.ts +3 -0
- data/payload/node_modules/@inquirer/core/dist/esm/lib/use-keypress.js +20 -0
- data/payload/node_modules/@inquirer/core/dist/esm/lib/use-memo.d.ts +1 -0
- data/payload/node_modules/@inquirer/core/dist/esm/lib/use-memo.js +14 -0
- data/payload/node_modules/@inquirer/core/dist/esm/lib/use-prefix.d.ts +5 -0
- data/payload/node_modules/@inquirer/core/dist/esm/lib/use-prefix.js +35 -0
- data/payload/node_modules/@inquirer/core/dist/esm/lib/use-ref.d.ts +6 -0
- data/payload/node_modules/@inquirer/core/dist/esm/lib/use-ref.js +4 -0
- data/payload/node_modules/@inquirer/core/dist/esm/lib/use-state.d.ts +4 -0
- data/payload/node_modules/@inquirer/core/dist/esm/lib/use-state.js +20 -0
- data/payload/node_modules/@inquirer/core/dist/esm/lib/utils.d.ts +13 -0
- data/payload/node_modules/@inquirer/core/dist/esm/lib/utils.js +25 -0
- data/payload/node_modules/@inquirer/core/dist/esm/package.json +3 -0
- data/payload/node_modules/@inquirer/core/node_modules/mute-stream/LICENSE +15 -0
- data/payload/node_modules/@inquirer/core/node_modules/mute-stream/README.md +68 -0
- data/payload/node_modules/@inquirer/core/node_modules/mute-stream/lib/index.js +142 -0
- data/payload/node_modules/@inquirer/core/node_modules/mute-stream/package.json +54 -0
- data/payload/node_modules/@inquirer/core/package.json +119 -0
- data/payload/node_modules/@inquirer/figures/LICENSE +22 -0
- data/payload/node_modules/@inquirer/figures/dist/commonjs/index.d.ts +275 -0
- data/payload/node_modules/@inquirer/figures/dist/commonjs/index.js +321 -0
- data/payload/node_modules/@inquirer/figures/dist/commonjs/package.json +3 -0
- data/payload/node_modules/@inquirer/figures/dist/esm/index.d.ts +275 -0
- data/payload/node_modules/@inquirer/figures/dist/esm/index.js +314 -0
- data/payload/node_modules/@inquirer/figures/dist/esm/package.json +3 -0
- data/payload/node_modules/@inquirer/figures/package.json +98 -0
- data/payload/node_modules/@inquirer/input/LICENSE +22 -0
- data/payload/node_modules/@inquirer/input/README.md +101 -0
- data/payload/node_modules/@inquirer/input/dist/commonjs/index.d.ts +20 -0
- data/payload/node_modules/@inquirer/input/dist/commonjs/index.js +99 -0
- data/payload/node_modules/@inquirer/input/dist/commonjs/package.json +3 -0
- data/payload/node_modules/@inquirer/input/dist/esm/index.d.ts +20 -0
- data/payload/node_modules/@inquirer/input/dist/esm/index.js +97 -0
- data/payload/node_modules/@inquirer/input/dist/esm/package.json +3 -0
- data/payload/node_modules/@inquirer/input/package.json +110 -0
- data/payload/node_modules/@inquirer/password/LICENSE +22 -0
- data/payload/node_modules/@inquirer/password/README.md +93 -0
- data/payload/node_modules/@inquirer/password/dist/commonjs/index.d.ts +10 -0
- data/payload/node_modules/@inquirer/password/dist/commonjs/index.js +57 -0
- data/payload/node_modules/@inquirer/password/dist/commonjs/package.json +3 -0
- data/payload/node_modules/@inquirer/password/dist/esm/index.d.ts +10 -0
- data/payload/node_modules/@inquirer/password/dist/esm/index.js +55 -0
- data/payload/node_modules/@inquirer/password/dist/esm/package.json +3 -0
- data/payload/node_modules/@inquirer/password/package.json +111 -0
- data/payload/node_modules/@inquirer/type/LICENSE +22 -0
- data/payload/node_modules/@inquirer/type/dist/commonjs/index.d.ts +2 -0
- data/payload/node_modules/@inquirer/type/dist/commonjs/index.js +18 -0
- data/payload/node_modules/@inquirer/type/dist/commonjs/inquirer.d.ts +38 -0
- data/payload/node_modules/@inquirer/type/dist/commonjs/inquirer.js +2 -0
- data/payload/node_modules/@inquirer/type/dist/commonjs/package.json +3 -0
- data/payload/node_modules/@inquirer/type/dist/commonjs/utils.d.ts +29 -0
- data/payload/node_modules/@inquirer/type/dist/commonjs/utils.js +3 -0
- data/payload/node_modules/@inquirer/type/dist/esm/index.d.ts +2 -0
- data/payload/node_modules/@inquirer/type/dist/esm/index.js +2 -0
- data/payload/node_modules/@inquirer/type/dist/esm/inquirer.d.ts +38 -0
- data/payload/node_modules/@inquirer/type/dist/esm/inquirer.js +1 -0
- data/payload/node_modules/@inquirer/type/dist/esm/package.json +3 -0
- data/payload/node_modules/@inquirer/type/dist/esm/utils.d.ts +29 -0
- data/payload/node_modules/@inquirer/type/dist/esm/utils.js +2 -0
- data/payload/node_modules/@inquirer/type/package.json +106 -0
- data/payload/node_modules/@oclif/core/LICENSE +21 -0
- data/payload/node_modules/@oclif/core/README.md +150 -0
- data/payload/node_modules/@oclif/core/lib/args.d.ts +56 -0
- data/payload/node_modules/@oclif/core/lib/args.js +85 -0
- data/payload/node_modules/@oclif/core/lib/cache.d.ts +27 -0
- data/payload/node_modules/@oclif/core/lib/cache.js +40 -0
- data/payload/node_modules/@oclif/core/lib/command.d.ts +192 -0
- data/payload/node_modules/@oclif/core/lib/command.js +350 -0
- data/payload/node_modules/@oclif/core/lib/config/config.d.ts +135 -0
- data/payload/node_modules/@oclif/core/lib/config/config.js +749 -0
- data/payload/node_modules/@oclif/core/lib/config/index.d.ts +3 -0
- data/payload/node_modules/@oclif/core/lib/config/index.js +9 -0
- data/payload/node_modules/@oclif/core/lib/config/plugin-loader.d.ts +38 -0
- data/payload/node_modules/@oclif/core/lib/config/plugin-loader.js +188 -0
- data/payload/node_modules/@oclif/core/lib/config/plugin.d.ts +51 -0
- data/payload/node_modules/@oclif/core/lib/config/plugin.js +373 -0
- data/payload/node_modules/@oclif/core/lib/config/ts-path.d.ts +9 -0
- data/payload/node_modules/@oclif/core/lib/config/ts-path.js +293 -0
- data/payload/node_modules/@oclif/core/lib/config/util.d.ts +23 -0
- data/payload/node_modules/@oclif/core/lib/config/util.js +54 -0
- data/payload/node_modules/@oclif/core/lib/constraints.d.ts +217 -0
- data/payload/node_modules/@oclif/core/lib/constraints.js +638 -0
- data/payload/node_modules/@oclif/core/lib/errors/error.d.ts +8 -0
- data/payload/node_modules/@oclif/core/lib/errors/error.js +63 -0
- data/payload/node_modules/@oclif/core/lib/errors/errors/cli.d.ts +29 -0
- data/payload/node_modules/@oclif/core/lib/errors/errors/cli.js +77 -0
- data/payload/node_modules/@oclif/core/lib/errors/errors/exit.d.ts +7 -0
- data/payload/node_modules/@oclif/core/lib/errors/errors/exit.js +14 -0
- data/payload/node_modules/@oclif/core/lib/errors/errors/module-load.d.ts +6 -0
- data/payload/node_modules/@oclif/core/lib/errors/errors/module-load.js +12 -0
- data/payload/node_modules/@oclif/core/lib/errors/errors/pretty-print.d.ts +9 -0
- data/payload/node_modules/@oclif/core/lib/errors/errors/pretty-print.js +67 -0
- data/payload/node_modules/@oclif/core/lib/errors/exit.d.ts +1 -0
- data/payload/node_modules/@oclif/core/lib/errors/exit.js +7 -0
- data/payload/node_modules/@oclif/core/lib/errors/handle.d.ts +14 -0
- data/payload/node_modules/@oclif/core/lib/errors/handle.js +60 -0
- data/payload/node_modules/@oclif/core/lib/errors/index.d.ts +8 -0
- data/payload/node_modules/@oclif/core/lib/errors/index.js +17 -0
- data/payload/node_modules/@oclif/core/lib/errors/warn.d.ts +8 -0
- data/payload/node_modules/@oclif/core/lib/errors/warn.js +40 -0
- data/payload/node_modules/@oclif/core/lib/execute.d.ts +44 -0
- data/payload/node_modules/@oclif/core/lib/execute.js +61 -0
- data/payload/node_modules/@oclif/core/lib/flags.d.ts +181 -0
- data/payload/node_modules/@oclif/core/lib/flags.js +129 -0
- data/payload/node_modules/@oclif/core/lib/flush.d.ts +1 -0
- data/payload/node_modules/@oclif/core/lib/flush.js +26 -0
- data/payload/node_modules/@oclif/core/lib/help/command.d.ts +33 -0
- data/payload/node_modules/@oclif/core/lib/help/command.js +352 -0
- data/payload/node_modules/@oclif/core/lib/help/docopts.d.ts +69 -0
- data/payload/node_modules/@oclif/core/lib/help/docopts.js +198 -0
- data/payload/node_modules/@oclif/core/lib/help/formatter.d.ts +96 -0
- data/payload/node_modules/@oclif/core/lib/help/formatter.js +194 -0
- data/payload/node_modules/@oclif/core/lib/help/index.d.ts +46 -0
- data/payload/node_modules/@oclif/core/lib/help/index.js +345 -0
- data/payload/node_modules/@oclif/core/lib/help/root.d.ts +11 -0
- data/payload/node_modules/@oclif/core/lib/help/root.js +47 -0
- data/payload/node_modules/@oclif/core/lib/help/util.d.ts +7 -0
- data/payload/node_modules/@oclif/core/lib/help/util.js +99 -0
- data/payload/node_modules/@oclif/core/lib/index.d.ts +20 -0
- data/payload/node_modules/@oclif/core/lib/index.js +101 -0
- data/payload/node_modules/@oclif/core/lib/interfaces/alphabet.d.ts +2 -0
- data/payload/node_modules/@oclif/core/lib/interfaces/alphabet.js +2 -0
- data/payload/node_modules/@oclif/core/lib/interfaces/args.d.ts +22 -0
- data/payload/node_modules/@oclif/core/lib/interfaces/args.js +2 -0
- data/payload/node_modules/@oclif/core/lib/interfaces/config.d.ts +139 -0
- data/payload/node_modules/@oclif/core/lib/interfaces/config.js +2 -0
- data/payload/node_modules/@oclif/core/lib/interfaces/errors.d.ts +27 -0
- data/payload/node_modules/@oclif/core/lib/interfaces/errors.js +2 -0
- data/payload/node_modules/@oclif/core/lib/interfaces/flags.d.ts +34 -0
- data/payload/node_modules/@oclif/core/lib/interfaces/flags.js +2 -0
- data/payload/node_modules/@oclif/core/lib/interfaces/help.d.ts +58 -0
- data/payload/node_modules/@oclif/core/lib/interfaces/help.js +2 -0
- data/payload/node_modules/@oclif/core/lib/interfaces/hooks.d.ts +185 -0
- data/payload/node_modules/@oclif/core/lib/interfaces/hooks.js +2 -0
- data/payload/node_modules/@oclif/core/lib/interfaces/index.d.ts +16 -0
- data/payload/node_modules/@oclif/core/lib/interfaces/index.js +2 -0
- data/payload/node_modules/@oclif/core/lib/interfaces/logger.d.ts +9 -0
- data/payload/node_modules/@oclif/core/lib/interfaces/logger.js +2 -0
- data/payload/node_modules/@oclif/core/lib/interfaces/manifest.d.ts +7 -0
- data/payload/node_modules/@oclif/core/lib/interfaces/manifest.js +2 -0
- data/payload/node_modules/@oclif/core/lib/interfaces/parser.d.ts +520 -0
- data/payload/node_modules/@oclif/core/lib/interfaces/parser.js +2 -0
- data/payload/node_modules/@oclif/core/lib/interfaces/pjson.d.ts +314 -0
- data/payload/node_modules/@oclif/core/lib/interfaces/pjson.js +2 -0
- data/payload/node_modules/@oclif/core/lib/interfaces/plugin.d.ts +104 -0
- data/payload/node_modules/@oclif/core/lib/interfaces/plugin.js +2 -0
- data/payload/node_modules/@oclif/core/lib/interfaces/s3-manifest.d.ts +14 -0
- data/payload/node_modules/@oclif/core/lib/interfaces/s3-manifest.js +2 -0
- data/payload/node_modules/@oclif/core/lib/interfaces/theme.d.ts +32 -0
- data/payload/node_modules/@oclif/core/lib/interfaces/theme.js +44 -0
- data/payload/node_modules/@oclif/core/lib/interfaces/topic.d.ts +5 -0
- data/payload/node_modules/@oclif/core/lib/interfaces/topic.js +2 -0
- data/payload/node_modules/@oclif/core/lib/interfaces/ts-config.d.ts +23 -0
- data/payload/node_modules/@oclif/core/lib/interfaces/ts-config.js +2 -0
- data/payload/node_modules/@oclif/core/lib/logger.d.ts +14 -0
- data/payload/node_modules/@oclif/core/lib/logger.js +89 -0
- data/payload/node_modules/@oclif/core/lib/main.d.ts +4 -0
- data/payload/node_modules/@oclif/core/lib/main.js +106 -0
- data/payload/node_modules/@oclif/core/lib/module-loader.d.ts +71 -0
- data/payload/node_modules/@oclif/core/lib/module-loader.js +206 -0
- data/payload/node_modules/@oclif/core/lib/parser/errors.d.ts +58 -0
- data/payload/node_modules/@oclif/core/lib/parser/errors.js +117 -0
- data/payload/node_modules/@oclif/core/lib/parser/help.d.ts +3 -0
- data/payload/node_modules/@oclif/core/lib/parser/help.js +29 -0
- data/payload/node_modules/@oclif/core/lib/parser/index.d.ts +5 -0
- data/payload/node_modules/@oclif/core/lib/parser/index.js +25 -0
- data/payload/node_modules/@oclif/core/lib/parser/parse.d.ts +37 -0
- data/payload/node_modules/@oclif/core/lib/parser/parse.js +545 -0
- data/payload/node_modules/@oclif/core/lib/parser/validate.d.ts +5 -0
- data/payload/node_modules/@oclif/core/lib/parser/validate.js +287 -0
- data/payload/node_modules/@oclif/core/lib/performance.d.ts +73 -0
- data/payload/node_modules/@oclif/core/lib/performance.js +227 -0
- data/payload/node_modules/@oclif/core/lib/screen.d.ts +2 -0
- data/payload/node_modules/@oclif/core/lib/screen.js +20 -0
- data/payload/node_modules/@oclif/core/lib/settings.d.ts +36 -0
- data/payload/node_modules/@oclif/core/lib/settings.js +7 -0
- data/payload/node_modules/@oclif/core/lib/symbols.d.ts +1 -0
- data/payload/node_modules/@oclif/core/lib/symbols.js +4 -0
- data/payload/node_modules/@oclif/core/lib/util/aggregate-flags.d.ts +2 -0
- data/payload/node_modules/@oclif/core/lib/util/aggregate-flags.js +12 -0
- data/payload/node_modules/@oclif/core/lib/util/cache-command.d.ts +3 -0
- data/payload/node_modules/@oclif/core/lib/util/cache-command.js +120 -0
- data/payload/node_modules/@oclif/core/lib/util/cache-default-value.d.ts +2 -0
- data/payload/node_modules/@oclif/core/lib/util/cache-default-value.js +28 -0
- data/payload/node_modules/@oclif/core/lib/util/determine-priority.d.ts +18 -0
- data/payload/node_modules/@oclif/core/lib/util/determine-priority.js +51 -0
- data/payload/node_modules/@oclif/core/lib/util/ensure-arg-object.d.ts +12 -0
- data/payload/node_modules/@oclif/core/lib/util/ensure-arg-object.js +13 -0
- data/payload/node_modules/@oclif/core/lib/util/find-root.d.ts +16 -0
- data/payload/node_modules/@oclif/core/lib/util/find-root.js +185 -0
- data/payload/node_modules/@oclif/core/lib/util/fs.d.ts +35 -0
- data/payload/node_modules/@oclif/core/lib/util/fs.js +93 -0
- data/payload/node_modules/@oclif/core/lib/util/ids.d.ts +3 -0
- data/payload/node_modules/@oclif/core/lib/util/ids.js +11 -0
- data/payload/node_modules/@oclif/core/lib/util/os.d.ts +19 -0
- data/payload/node_modules/@oclif/core/lib/util/os.js +58 -0
- data/payload/node_modules/@oclif/core/lib/util/read-pjson.d.ts +7 -0
- data/payload/node_modules/@oclif/core/lib/util/read-pjson.js +55 -0
- data/payload/node_modules/@oclif/core/lib/util/read-tsconfig.d.ts +2 -0
- data/payload/node_modules/@oclif/core/lib/util/read-tsconfig.js +77 -0
- data/payload/node_modules/@oclif/core/lib/util/util.d.ts +23 -0
- data/payload/node_modules/@oclif/core/lib/util/util.js +103 -0
- data/payload/node_modules/@oclif/core/lib/ux/action/base.d.ts +34 -0
- data/payload/node_modules/@oclif/core/lib/ux/action/base.js +183 -0
- data/payload/node_modules/@oclif/core/lib/ux/action/simple.d.ts +11 -0
- data/payload/node_modules/@oclif/core/lib/ux/action/simple.js +47 -0
- data/payload/node_modules/@oclif/core/lib/ux/action/spinner.d.ts +19 -0
- data/payload/node_modules/@oclif/core/lib/ux/action/spinner.js +88 -0
- data/payload/node_modules/@oclif/core/lib/ux/action/types.d.ts +5 -0
- data/payload/node_modules/@oclif/core/lib/ux/action/types.js +2 -0
- data/payload/node_modules/@oclif/core/lib/ux/colorize-json.d.ts +29 -0
- data/payload/node_modules/@oclif/core/lib/ux/colorize-json.js +100 -0
- data/payload/node_modules/@oclif/core/lib/ux/index.d.ts +70 -0
- data/payload/node_modules/@oclif/core/lib/ux/index.js +89 -0
- data/payload/node_modules/@oclif/core/lib/ux/list.d.ts +3 -0
- data/payload/node_modules/@oclif/core/lib/ux/list.js +28 -0
- data/payload/node_modules/@oclif/core/lib/ux/supports-color.d.ts +1 -0
- data/payload/node_modules/@oclif/core/lib/ux/supports-color.js +7 -0
- data/payload/node_modules/@oclif/core/lib/ux/theme.d.ts +9 -0
- data/payload/node_modules/@oclif/core/lib/ux/theme.js +45 -0
- data/payload/node_modules/@oclif/core/lib/ux/write.d.ts +2 -0
- data/payload/node_modules/@oclif/core/lib/ux/write.js +34 -0
- data/payload/node_modules/@oclif/core/node_modules/balanced-match/LICENSE.md +23 -0
- data/payload/node_modules/@oclif/core/node_modules/balanced-match/README.md +57 -0
- data/payload/node_modules/@oclif/core/node_modules/balanced-match/dist/commonjs/index.d.ts +9 -0
- data/payload/node_modules/@oclif/core/node_modules/balanced-match/dist/commonjs/index.d.ts.map +1 -0
- data/payload/node_modules/@oclif/core/node_modules/balanced-match/dist/commonjs/index.js +59 -0
- data/payload/node_modules/@oclif/core/node_modules/balanced-match/dist/commonjs/index.js.map +1 -0
- data/payload/node_modules/@oclif/core/node_modules/balanced-match/dist/commonjs/package.json +3 -0
- data/payload/node_modules/@oclif/core/node_modules/balanced-match/dist/esm/index.d.ts +9 -0
- data/payload/node_modules/@oclif/core/node_modules/balanced-match/dist/esm/index.d.ts.map +1 -0
- data/payload/node_modules/@oclif/core/node_modules/balanced-match/dist/esm/index.js +54 -0
- data/payload/node_modules/@oclif/core/node_modules/balanced-match/dist/esm/index.js.map +1 -0
- data/payload/node_modules/@oclif/core/node_modules/balanced-match/dist/esm/package.json +3 -0
- data/payload/node_modules/@oclif/core/node_modules/balanced-match/package.json +68 -0
- data/payload/node_modules/@oclif/core/node_modules/brace-expansion/LICENSE +23 -0
- data/payload/node_modules/@oclif/core/node_modules/brace-expansion/README.md +105 -0
- data/payload/node_modules/@oclif/core/node_modules/brace-expansion/dist/commonjs/index.d.ts +8 -0
- data/payload/node_modules/@oclif/core/node_modules/brace-expansion/dist/commonjs/index.d.ts.map +1 -0
- data/payload/node_modules/@oclif/core/node_modules/brace-expansion/dist/commonjs/index.js +289 -0
- data/payload/node_modules/@oclif/core/node_modules/brace-expansion/dist/commonjs/index.js.map +1 -0
- data/payload/node_modules/@oclif/core/node_modules/brace-expansion/dist/commonjs/package.json +3 -0
- data/payload/node_modules/@oclif/core/node_modules/brace-expansion/dist/esm/index.d.ts +8 -0
- data/payload/node_modules/@oclif/core/node_modules/brace-expansion/dist/esm/index.d.ts.map +1 -0
- data/payload/node_modules/@oclif/core/node_modules/brace-expansion/dist/esm/index.js +285 -0
- data/payload/node_modules/@oclif/core/node_modules/brace-expansion/dist/esm/index.js.map +1 -0
- data/payload/node_modules/@oclif/core/node_modules/brace-expansion/dist/esm/package.json +3 -0
- data/payload/node_modules/@oclif/core/node_modules/brace-expansion/package.json +64 -0
- data/payload/node_modules/@oclif/core/node_modules/ejs/LICENSE +202 -0
- data/payload/node_modules/@oclif/core/node_modules/ejs/README.md +389 -0
- data/payload/node_modules/@oclif/core/node_modules/ejs/bin/cli.js +218 -0
- data/payload/node_modules/@oclif/core/node_modules/ejs/ejs.js +1820 -0
- data/payload/node_modules/@oclif/core/node_modules/ejs/ejs.min.js +1 -0
- data/payload/node_modules/@oclif/core/node_modules/ejs/jakefile.js +206 -0
- data/payload/node_modules/@oclif/core/node_modules/ejs/lib/cjs/ejs.js +853 -0
- data/payload/node_modules/@oclif/core/node_modules/ejs/lib/cjs/package.json +1 -0
- data/payload/node_modules/@oclif/core/node_modules/ejs/lib/cjs/parseargs.js +122 -0
- data/payload/node_modules/@oclif/core/node_modules/ejs/lib/cjs/utils.js +242 -0
- data/payload/node_modules/@oclif/core/node_modules/ejs/lib/esm/ejs.js +936 -0
- data/payload/node_modules/@oclif/core/node_modules/ejs/lib/esm/package.json +3 -0
- data/payload/node_modules/@oclif/core/node_modules/ejs/lib/esm/parseargs.js +136 -0
- data/payload/node_modules/@oclif/core/node_modules/ejs/lib/esm/utils.js +259 -0
- data/payload/node_modules/@oclif/core/node_modules/ejs/package.json +49 -0
- data/payload/node_modules/@oclif/core/node_modules/ejs/usage.txt +24 -0
- data/payload/node_modules/@oclif/core/node_modules/minimatch/LICENSE.md +55 -0
- data/payload/node_modules/@oclif/core/node_modules/minimatch/README.md +528 -0
- data/payload/node_modules/@oclif/core/node_modules/minimatch/dist/commonjs/assert-valid-pattern.d.ts +2 -0
- data/payload/node_modules/@oclif/core/node_modules/minimatch/dist/commonjs/assert-valid-pattern.d.ts.map +1 -0
- data/payload/node_modules/@oclif/core/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js +14 -0
- data/payload/node_modules/@oclif/core/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js.map +1 -0
- data/payload/node_modules/@oclif/core/node_modules/minimatch/dist/commonjs/ast.d.ts +22 -0
- data/payload/node_modules/@oclif/core/node_modules/minimatch/dist/commonjs/ast.d.ts.map +1 -0
- data/payload/node_modules/@oclif/core/node_modules/minimatch/dist/commonjs/ast.js +845 -0
- data/payload/node_modules/@oclif/core/node_modules/minimatch/dist/commonjs/ast.js.map +1 -0
- data/payload/node_modules/@oclif/core/node_modules/minimatch/dist/commonjs/brace-expressions.d.ts +8 -0
- data/payload/node_modules/@oclif/core/node_modules/minimatch/dist/commonjs/brace-expressions.d.ts.map +1 -0
- data/payload/node_modules/@oclif/core/node_modules/minimatch/dist/commonjs/brace-expressions.js +150 -0
- data/payload/node_modules/@oclif/core/node_modules/minimatch/dist/commonjs/brace-expressions.js.map +1 -0
- data/payload/node_modules/@oclif/core/node_modules/minimatch/dist/commonjs/escape.d.ts +15 -0
- data/payload/node_modules/@oclif/core/node_modules/minimatch/dist/commonjs/escape.d.ts.map +1 -0
- data/payload/node_modules/@oclif/core/node_modules/minimatch/dist/commonjs/escape.js +30 -0
- data/payload/node_modules/@oclif/core/node_modules/minimatch/dist/commonjs/escape.js.map +1 -0
- data/payload/node_modules/@oclif/core/node_modules/minimatch/dist/commonjs/index.d.ts +174 -0
- data/payload/node_modules/@oclif/core/node_modules/minimatch/dist/commonjs/index.d.ts.map +1 -0
- data/payload/node_modules/@oclif/core/node_modules/minimatch/dist/commonjs/index.js +1127 -0
- data/payload/node_modules/@oclif/core/node_modules/minimatch/dist/commonjs/index.js.map +1 -0
- data/payload/node_modules/@oclif/core/node_modules/minimatch/dist/commonjs/package.json +3 -0
- data/payload/node_modules/@oclif/core/node_modules/minimatch/dist/commonjs/unescape.d.ts +22 -0
- data/payload/node_modules/@oclif/core/node_modules/minimatch/dist/commonjs/unescape.d.ts.map +1 -0
- data/payload/node_modules/@oclif/core/node_modules/minimatch/dist/commonjs/unescape.js +38 -0
- data/payload/node_modules/@oclif/core/node_modules/minimatch/dist/commonjs/unescape.js.map +1 -0
- data/payload/node_modules/@oclif/core/node_modules/minimatch/dist/esm/assert-valid-pattern.d.ts +2 -0
- data/payload/node_modules/@oclif/core/node_modules/minimatch/dist/esm/assert-valid-pattern.d.ts.map +1 -0
- data/payload/node_modules/@oclif/core/node_modules/minimatch/dist/esm/assert-valid-pattern.js +10 -0
- data/payload/node_modules/@oclif/core/node_modules/minimatch/dist/esm/assert-valid-pattern.js.map +1 -0
- data/payload/node_modules/@oclif/core/node_modules/minimatch/dist/esm/ast.d.ts +22 -0
- data/payload/node_modules/@oclif/core/node_modules/minimatch/dist/esm/ast.d.ts.map +1 -0
- data/payload/node_modules/@oclif/core/node_modules/minimatch/dist/esm/ast.js +841 -0
- data/payload/node_modules/@oclif/core/node_modules/minimatch/dist/esm/ast.js.map +1 -0
- data/payload/node_modules/@oclif/core/node_modules/minimatch/dist/esm/brace-expressions.d.ts +8 -0
- data/payload/node_modules/@oclif/core/node_modules/minimatch/dist/esm/brace-expressions.d.ts.map +1 -0
- data/payload/node_modules/@oclif/core/node_modules/minimatch/dist/esm/brace-expressions.js +146 -0
- data/payload/node_modules/@oclif/core/node_modules/minimatch/dist/esm/brace-expressions.js.map +1 -0
- data/payload/node_modules/@oclif/core/node_modules/minimatch/dist/esm/escape.d.ts +15 -0
- data/payload/node_modules/@oclif/core/node_modules/minimatch/dist/esm/escape.d.ts.map +1 -0
- data/payload/node_modules/@oclif/core/node_modules/minimatch/dist/esm/escape.js +26 -0
- data/payload/node_modules/@oclif/core/node_modules/minimatch/dist/esm/escape.js.map +1 -0
- data/payload/node_modules/@oclif/core/node_modules/minimatch/dist/esm/index.d.ts +174 -0
- data/payload/node_modules/@oclif/core/node_modules/minimatch/dist/esm/index.d.ts.map +1 -0
- data/payload/node_modules/@oclif/core/node_modules/minimatch/dist/esm/index.js +1114 -0
- data/payload/node_modules/@oclif/core/node_modules/minimatch/dist/esm/index.js.map +1 -0
- data/payload/node_modules/@oclif/core/node_modules/minimatch/dist/esm/package.json +3 -0
- data/payload/node_modules/@oclif/core/node_modules/minimatch/dist/esm/unescape.d.ts +22 -0
- data/payload/node_modules/@oclif/core/node_modules/minimatch/dist/esm/unescape.d.ts.map +1 -0
- data/payload/node_modules/@oclif/core/node_modules/minimatch/dist/esm/unescape.js +34 -0
- data/payload/node_modules/@oclif/core/node_modules/minimatch/dist/esm/unescape.js.map +1 -0
- data/payload/node_modules/@oclif/core/node_modules/minimatch/package.json +73 -0
- data/payload/node_modules/@oclif/core/node_modules/wrap-ansi/index.js +216 -0
- data/payload/node_modules/@oclif/core/node_modules/wrap-ansi/license +9 -0
- data/payload/node_modules/@oclif/core/node_modules/wrap-ansi/package.json +62 -0
- data/payload/node_modules/@oclif/core/node_modules/wrap-ansi/readme.md +91 -0
- data/payload/node_modules/@oclif/core/package.json +135 -0
- data/payload/node_modules/@oclif/plugin-help/LICENSE +21 -0
- data/payload/node_modules/@oclif/plugin-help/README.md +35 -0
- data/payload/node_modules/@oclif/plugin-help/lib/commands/help.d.ts +12 -0
- data/payload/node_modules/@oclif/plugin-help/lib/commands/help.js +20 -0
- data/payload/node_modules/@oclif/plugin-help/lib/index.d.ts +4 -0
- data/payload/node_modules/@oclif/plugin-help/lib/index.js +4 -0
- data/payload/node_modules/@oclif/plugin-help/oclif.manifest.json +43 -0
- data/payload/node_modules/@oclif/plugin-help/package.json +68 -0
- data/payload/node_modules/ansi-escapes/index.d.ts +248 -0
- data/payload/node_modules/ansi-escapes/index.js +157 -0
- data/payload/node_modules/ansi-escapes/license +9 -0
- data/payload/node_modules/ansi-escapes/package.json +57 -0
- data/payload/node_modules/ansi-escapes/readme.md +245 -0
- data/payload/node_modules/ansi-regex/index.d.ts +37 -0
- data/payload/node_modules/ansi-regex/index.js +10 -0
- data/payload/node_modules/ansi-regex/license +9 -0
- data/payload/node_modules/ansi-regex/package.json +55 -0
- data/payload/node_modules/ansi-regex/readme.md +78 -0
- data/payload/node_modules/ansi-styles/index.d.ts +345 -0
- data/payload/node_modules/ansi-styles/index.js +163 -0
- data/payload/node_modules/ansi-styles/license +9 -0
- data/payload/node_modules/ansi-styles/package.json +56 -0
- data/payload/node_modules/ansi-styles/readme.md +152 -0
- data/payload/node_modules/ansis/LICENSE +15 -0
- data/payload/node_modules/ansis/README.md +3 -0
- data/payload/node_modules/ansis/index.d.ts +1 -0
- data/payload/node_modules/ansis/index.js +1 -0
- data/payload/node_modules/ansis/index.mjs +1 -0
- data/payload/node_modules/ansis/package.json +20 -0
- data/payload/node_modules/clean-stack/index.d.ts +56 -0
- data/payload/node_modules/clean-stack/index.js +45 -0
- data/payload/node_modules/clean-stack/license +9 -0
- data/payload/node_modules/clean-stack/package.json +42 -0
- data/payload/node_modules/clean-stack/readme.md +77 -0
- data/payload/node_modules/cli-spinners/index.d.ts +128 -0
- data/payload/node_modules/cli-spinners/index.js +15 -0
- data/payload/node_modules/cli-spinners/license +9 -0
- data/payload/node_modules/cli-spinners/package.json +50 -0
- data/payload/node_modules/cli-spinners/readme.md +54 -0
- data/payload/node_modules/cli-spinners/spinners.json +1622 -0
- data/payload/node_modules/cli-width/LICENSE +13 -0
- data/payload/node_modules/cli-width/README.md +71 -0
- data/payload/node_modules/cli-width/index.d.ts +13 -0
- data/payload/node_modules/cli-width/index.js +49 -0
- data/payload/node_modules/cli-width/package.json +40 -0
- data/payload/node_modules/color-convert/CHANGELOG.md +54 -0
- data/payload/node_modules/color-convert/LICENSE +21 -0
- data/payload/node_modules/color-convert/README.md +68 -0
- data/payload/node_modules/color-convert/conversions.js +839 -0
- data/payload/node_modules/color-convert/index.js +81 -0
- data/payload/node_modules/color-convert/package.json +48 -0
- data/payload/node_modules/color-convert/route.js +97 -0
- data/payload/node_modules/color-name/LICENSE +8 -0
- data/payload/node_modules/color-name/README.md +11 -0
- data/payload/node_modules/color-name/index.js +152 -0
- data/payload/node_modules/color-name/package.json +28 -0
- data/payload/node_modules/debug/LICENSE +20 -0
- data/payload/node_modules/debug/README.md +481 -0
- data/payload/node_modules/debug/package.json +64 -0
- data/payload/node_modules/debug/src/browser.js +272 -0
- data/payload/node_modules/debug/src/common.js +292 -0
- data/payload/node_modules/debug/src/index.js +10 -0
- data/payload/node_modules/debug/src/node.js +263 -0
- data/payload/node_modules/emoji-regex/LICENSE-MIT.txt +20 -0
- data/payload/node_modules/emoji-regex/README.md +73 -0
- data/payload/node_modules/emoji-regex/es2015/index.js +6 -0
- data/payload/node_modules/emoji-regex/es2015/text.js +6 -0
- data/payload/node_modules/emoji-regex/index.d.ts +23 -0
- data/payload/node_modules/emoji-regex/index.js +6 -0
- data/payload/node_modules/emoji-regex/package.json +50 -0
- data/payload/node_modules/emoji-regex/text.js +6 -0
- data/payload/node_modules/escape-string-regexp/index.d.ts +18 -0
- data/payload/node_modules/escape-string-regexp/index.js +13 -0
- data/payload/node_modules/escape-string-regexp/license +9 -0
- data/payload/node_modules/escape-string-regexp/package.json +38 -0
- data/payload/node_modules/escape-string-regexp/readme.md +34 -0
- data/payload/node_modules/fdir/LICENSE +7 -0
- data/payload/node_modules/fdir/README.md +91 -0
- data/payload/node_modules/fdir/dist/index.cjs +588 -0
- data/payload/node_modules/fdir/dist/index.d.cts +155 -0
- data/payload/node_modules/fdir/dist/index.d.mts +155 -0
- data/payload/node_modules/fdir/dist/index.mjs +570 -0
- data/payload/node_modules/fdir/package.json +103 -0
- data/payload/node_modules/get-package-type/CHANGELOG.md +10 -0
- data/payload/node_modules/get-package-type/LICENSE +21 -0
- data/payload/node_modules/get-package-type/README.md +32 -0
- data/payload/node_modules/get-package-type/async.cjs +52 -0
- data/payload/node_modules/get-package-type/cache.cjs +3 -0
- data/payload/node_modules/get-package-type/index.cjs +7 -0
- data/payload/node_modules/get-package-type/is-node-modules.cjs +15 -0
- data/payload/node_modules/get-package-type/package.json +35 -0
- data/payload/node_modules/get-package-type/sync.cjs +42 -0
- data/payload/node_modules/has-flag/index.d.ts +39 -0
- data/payload/node_modules/has-flag/index.js +8 -0
- data/payload/node_modules/has-flag/license +9 -0
- data/payload/node_modules/has-flag/package.json +46 -0
- data/payload/node_modules/has-flag/readme.md +89 -0
- data/payload/node_modules/indent-string/index.d.ts +42 -0
- data/payload/node_modules/indent-string/index.js +35 -0
- data/payload/node_modules/indent-string/license +9 -0
- data/payload/node_modules/indent-string/package.json +37 -0
- data/payload/node_modules/indent-string/readme.md +70 -0
- data/payload/node_modules/is-docker/cli.js +5 -0
- data/payload/node_modules/is-docker/index.d.ts +13 -0
- data/payload/node_modules/is-docker/index.js +29 -0
- data/payload/node_modules/is-docker/license +9 -0
- data/payload/node_modules/is-docker/package.json +44 -0
- data/payload/node_modules/is-docker/readme.md +27 -0
- data/payload/node_modules/is-fullwidth-code-point/index.d.ts +17 -0
- data/payload/node_modules/is-fullwidth-code-point/index.js +50 -0
- data/payload/node_modules/is-fullwidth-code-point/license +9 -0
- data/payload/node_modules/is-fullwidth-code-point/package.json +42 -0
- data/payload/node_modules/is-fullwidth-code-point/readme.md +39 -0
- data/payload/node_modules/is-inside-container/cli.js +5 -0
- data/payload/node_modules/is-inside-container/index.d.ts +13 -0
- data/payload/node_modules/is-inside-container/index.js +23 -0
- data/payload/node_modules/is-inside-container/license +9 -0
- data/payload/node_modules/is-inside-container/package.json +51 -0
- data/payload/node_modules/is-inside-container/readme.md +36 -0
- data/payload/node_modules/is-wsl/index.d.ts +15 -0
- data/payload/node_modules/is-wsl/index.js +36 -0
- data/payload/node_modules/is-wsl/license +9 -0
- data/payload/node_modules/is-wsl/package.json +58 -0
- data/payload/node_modules/is-wsl/readme.md +21 -0
- data/payload/node_modules/lilconfig/LICENSE +21 -0
- data/payload/node_modules/lilconfig/package.json +42 -0
- data/payload/node_modules/lilconfig/readme.md +98 -0
- data/payload/node_modules/lilconfig/src/index.d.ts +54 -0
- data/payload/node_modules/lilconfig/src/index.js +460 -0
- data/payload/node_modules/ms/index.js +162 -0
- data/payload/node_modules/ms/license.md +21 -0
- data/payload/node_modules/ms/package.json +38 -0
- data/payload/node_modules/ms/readme.md +59 -0
- data/payload/node_modules/picomatch/LICENSE +21 -0
- data/payload/node_modules/picomatch/README.md +743 -0
- data/payload/node_modules/picomatch/index.js +17 -0
- data/payload/node_modules/picomatch/lib/constants.js +184 -0
- data/payload/node_modules/picomatch/lib/parse.js +1425 -0
- data/payload/node_modules/picomatch/lib/picomatch.js +361 -0
- data/payload/node_modules/picomatch/lib/scan.js +403 -0
- data/payload/node_modules/picomatch/lib/utils.js +72 -0
- data/payload/node_modules/picomatch/package.json +83 -0
- data/payload/node_modules/picomatch/posix.js +3 -0
- data/payload/node_modules/powershell-utils/index.d.ts +122 -0
- data/payload/node_modules/powershell-utils/index.js +58 -0
- data/payload/node_modules/powershell-utils/license +9 -0
- data/payload/node_modules/powershell-utils/package.json +47 -0
- data/payload/node_modules/powershell-utils/readme.md +153 -0
- data/payload/node_modules/semver/LICENSE +15 -0
- data/payload/node_modules/semver/README.md +680 -0
- data/payload/node_modules/semver/bin/semver.js +195 -0
- data/payload/node_modules/semver/classes/comparator.js +143 -0
- data/payload/node_modules/semver/classes/index.js +7 -0
- data/payload/node_modules/semver/classes/range.js +577 -0
- data/payload/node_modules/semver/classes/semver.js +350 -0
- data/payload/node_modules/semver/functions/clean.js +8 -0
- data/payload/node_modules/semver/functions/cmp.js +54 -0
- data/payload/node_modules/semver/functions/coerce.js +62 -0
- data/payload/node_modules/semver/functions/compare-build.js +9 -0
- data/payload/node_modules/semver/functions/compare-loose.js +5 -0
- data/payload/node_modules/semver/functions/compare.js +7 -0
- data/payload/node_modules/semver/functions/diff.js +60 -0
- data/payload/node_modules/semver/functions/eq.js +5 -0
- data/payload/node_modules/semver/functions/gt.js +5 -0
- data/payload/node_modules/semver/functions/gte.js +5 -0
- data/payload/node_modules/semver/functions/inc.js +21 -0
- data/payload/node_modules/semver/functions/lt.js +5 -0
- data/payload/node_modules/semver/functions/lte.js +5 -0
- data/payload/node_modules/semver/functions/major.js +5 -0
- data/payload/node_modules/semver/functions/minor.js +5 -0
- data/payload/node_modules/semver/functions/neq.js +5 -0
- data/payload/node_modules/semver/functions/parse.js +18 -0
- data/payload/node_modules/semver/functions/patch.js +5 -0
- data/payload/node_modules/semver/functions/prerelease.js +8 -0
- data/payload/node_modules/semver/functions/rcompare.js +5 -0
- data/payload/node_modules/semver/functions/rsort.js +5 -0
- data/payload/node_modules/semver/functions/satisfies.js +12 -0
- data/payload/node_modules/semver/functions/sort.js +5 -0
- data/payload/node_modules/semver/functions/truncate.js +48 -0
- data/payload/node_modules/semver/functions/valid.js +8 -0
- data/payload/node_modules/semver/index.js +93 -0
- data/payload/node_modules/semver/internal/constants.js +37 -0
- data/payload/node_modules/semver/internal/debug.js +11 -0
- data/payload/node_modules/semver/internal/identifiers.js +29 -0
- data/payload/node_modules/semver/internal/lrucache.js +42 -0
- data/payload/node_modules/semver/internal/parse-options.js +17 -0
- data/payload/node_modules/semver/internal/re.js +223 -0
- data/payload/node_modules/semver/package.json +78 -0
- data/payload/node_modules/semver/preload.js +4 -0
- data/payload/node_modules/semver/range.bnf +17 -0
- data/payload/node_modules/semver/ranges/gtr.js +6 -0
- data/payload/node_modules/semver/ranges/intersects.js +9 -0
- data/payload/node_modules/semver/ranges/ltr.js +6 -0
- data/payload/node_modules/semver/ranges/max-satisfying.js +27 -0
- data/payload/node_modules/semver/ranges/min-satisfying.js +26 -0
- data/payload/node_modules/semver/ranges/min-version.js +63 -0
- data/payload/node_modules/semver/ranges/outside.js +82 -0
- data/payload/node_modules/semver/ranges/simplify.js +49 -0
- data/payload/node_modules/semver/ranges/subset.js +249 -0
- data/payload/node_modules/semver/ranges/to-comparators.js +10 -0
- data/payload/node_modules/semver/ranges/valid.js +13 -0
- data/payload/node_modules/signal-exit/LICENSE.txt +16 -0
- data/payload/node_modules/signal-exit/README.md +74 -0
- data/payload/node_modules/signal-exit/dist/cjs/browser.d.ts +12 -0
- data/payload/node_modules/signal-exit/dist/cjs/browser.d.ts.map +1 -0
- data/payload/node_modules/signal-exit/dist/cjs/browser.js +10 -0
- data/payload/node_modules/signal-exit/dist/cjs/browser.js.map +1 -0
- data/payload/node_modules/signal-exit/dist/cjs/index.d.ts +48 -0
- data/payload/node_modules/signal-exit/dist/cjs/index.d.ts.map +1 -0
- data/payload/node_modules/signal-exit/dist/cjs/index.js +279 -0
- data/payload/node_modules/signal-exit/dist/cjs/index.js.map +1 -0
- data/payload/node_modules/signal-exit/dist/cjs/package.json +3 -0
- data/payload/node_modules/signal-exit/dist/cjs/signals.d.ts +29 -0
- data/payload/node_modules/signal-exit/dist/cjs/signals.d.ts.map +1 -0
- data/payload/node_modules/signal-exit/dist/cjs/signals.js +42 -0
- data/payload/node_modules/signal-exit/dist/cjs/signals.js.map +1 -0
- data/payload/node_modules/signal-exit/dist/mjs/browser.d.ts +12 -0
- data/payload/node_modules/signal-exit/dist/mjs/browser.d.ts.map +1 -0
- data/payload/node_modules/signal-exit/dist/mjs/browser.js +4 -0
- data/payload/node_modules/signal-exit/dist/mjs/browser.js.map +1 -0
- data/payload/node_modules/signal-exit/dist/mjs/index.d.ts +48 -0
- data/payload/node_modules/signal-exit/dist/mjs/index.d.ts.map +1 -0
- data/payload/node_modules/signal-exit/dist/mjs/index.js +275 -0
- data/payload/node_modules/signal-exit/dist/mjs/index.js.map +1 -0
- data/payload/node_modules/signal-exit/dist/mjs/package.json +3 -0
- data/payload/node_modules/signal-exit/dist/mjs/signals.d.ts +29 -0
- data/payload/node_modules/signal-exit/dist/mjs/signals.d.ts.map +1 -0
- data/payload/node_modules/signal-exit/dist/mjs/signals.js +39 -0
- data/payload/node_modules/signal-exit/dist/mjs/signals.js.map +1 -0
- data/payload/node_modules/signal-exit/package.json +106 -0
- data/payload/node_modules/string-width/index.d.ts +29 -0
- data/payload/node_modules/string-width/index.js +47 -0
- data/payload/node_modules/string-width/license +9 -0
- data/payload/node_modules/string-width/package.json +56 -0
- data/payload/node_modules/string-width/readme.md +50 -0
- data/payload/node_modules/strip-ansi/index.d.ts +17 -0
- data/payload/node_modules/strip-ansi/index.js +4 -0
- data/payload/node_modules/strip-ansi/license +9 -0
- data/payload/node_modules/strip-ansi/package.json +54 -0
- data/payload/node_modules/strip-ansi/readme.md +46 -0
- data/payload/node_modules/supports-color/browser.js +24 -0
- data/payload/node_modules/supports-color/index.js +152 -0
- data/payload/node_modules/supports-color/license +9 -0
- data/payload/node_modules/supports-color/package.json +58 -0
- data/payload/node_modules/supports-color/readme.md +77 -0
- data/payload/node_modules/tinyglobby/LICENSE +21 -0
- data/payload/node_modules/tinyglobby/README.md +25 -0
- data/payload/node_modules/tinyglobby/dist/index.cjs +335 -0
- data/payload/node_modules/tinyglobby/dist/index.d.cts +148 -0
- data/payload/node_modules/tinyglobby/dist/index.d.mts +148 -0
- data/payload/node_modules/tinyglobby/dist/index.mjs +307 -0
- data/payload/node_modules/tinyglobby/package.json +70 -0
- data/payload/node_modules/type-fest/base.d.ts +39 -0
- data/payload/node_modules/type-fest/index.d.ts +2 -0
- data/payload/node_modules/type-fest/license +9 -0
- data/payload/node_modules/type-fest/package.json +58 -0
- data/payload/node_modules/type-fest/readme.md +760 -0
- data/payload/node_modules/type-fest/source/async-return-type.d.ts +23 -0
- data/payload/node_modules/type-fest/source/asyncify.d.ts +31 -0
- data/payload/node_modules/type-fest/source/basic.d.ts +51 -0
- data/payload/node_modules/type-fest/source/conditional-except.d.ts +43 -0
- data/payload/node_modules/type-fest/source/conditional-keys.d.ts +43 -0
- data/payload/node_modules/type-fest/source/conditional-pick.d.ts +42 -0
- data/payload/node_modules/type-fest/source/entries.d.ts +57 -0
- data/payload/node_modules/type-fest/source/entry.d.ts +60 -0
- data/payload/node_modules/type-fest/source/except.d.ts +22 -0
- data/payload/node_modules/type-fest/source/fixed-length-array.d.ts +38 -0
- data/payload/node_modules/type-fest/source/iterable-element.d.ts +46 -0
- data/payload/node_modules/type-fest/source/literal-union.d.ts +33 -0
- data/payload/node_modules/type-fest/source/merge-exclusive.d.ts +39 -0
- data/payload/node_modules/type-fest/source/merge.d.ts +25 -0
- data/payload/node_modules/type-fest/source/mutable.d.ts +38 -0
- data/payload/node_modules/type-fest/source/opaque.d.ts +65 -0
- data/payload/node_modules/type-fest/source/package-json.d.ts +611 -0
- data/payload/node_modules/type-fest/source/partial-deep.d.ts +72 -0
- data/payload/node_modules/type-fest/source/promisable.d.ts +23 -0
- data/payload/node_modules/type-fest/source/promise-value.d.ts +27 -0
- data/payload/node_modules/type-fest/source/readonly-deep.d.ts +59 -0
- data/payload/node_modules/type-fest/source/require-at-least-one.d.ts +33 -0
- data/payload/node_modules/type-fest/source/require-exactly-one.d.ts +35 -0
- data/payload/node_modules/type-fest/source/set-optional.d.ts +33 -0
- data/payload/node_modules/type-fest/source/set-required.d.ts +33 -0
- data/payload/node_modules/type-fest/source/set-return-type.d.ts +29 -0
- data/payload/node_modules/type-fest/source/simplify.d.ts +4 -0
- data/payload/node_modules/type-fest/source/stringified.d.ts +21 -0
- data/payload/node_modules/type-fest/source/tsconfig-json.d.ts +870 -0
- data/payload/node_modules/type-fest/source/typed-array.d.ts +15 -0
- data/payload/node_modules/type-fest/source/union-to-intersection.d.ts +58 -0
- data/payload/node_modules/type-fest/source/utilities.d.ts +5 -0
- data/payload/node_modules/type-fest/source/value-of.d.ts +40 -0
- data/payload/node_modules/type-fest/ts41/camel-case.d.ts +64 -0
- data/payload/node_modules/type-fest/ts41/delimiter-case.d.ts +85 -0
- data/payload/node_modules/type-fest/ts41/get.d.ts +131 -0
- data/payload/node_modules/type-fest/ts41/index.d.ts +10 -0
- data/payload/node_modules/type-fest/ts41/kebab-case.d.ts +36 -0
- data/payload/node_modules/type-fest/ts41/pascal-case.d.ts +36 -0
- data/payload/node_modules/type-fest/ts41/snake-case.d.ts +35 -0
- data/payload/node_modules/type-fest/ts41/utilities.d.ts +8 -0
- data/payload/node_modules/undici-types/LICENSE +21 -0
- data/payload/node_modules/undici-types/README.md +6 -0
- data/payload/node_modules/undici-types/agent.d.ts +31 -0
- data/payload/node_modules/undici-types/api.d.ts +43 -0
- data/payload/node_modules/undici-types/balanced-pool.d.ts +29 -0
- data/payload/node_modules/undici-types/cache.d.ts +36 -0
- data/payload/node_modules/undici-types/client.d.ts +108 -0
- data/payload/node_modules/undici-types/connector.d.ts +34 -0
- data/payload/node_modules/undici-types/content-type.d.ts +21 -0
- data/payload/node_modules/undici-types/cookies.d.ts +28 -0
- data/payload/node_modules/undici-types/diagnostics-channel.d.ts +66 -0
- data/payload/node_modules/undici-types/dispatcher.d.ts +256 -0
- data/payload/node_modules/undici-types/env-http-proxy-agent.d.ts +21 -0
- data/payload/node_modules/undici-types/errors.d.ts +149 -0
- data/payload/node_modules/undici-types/eventsource.d.ts +61 -0
- data/payload/node_modules/undici-types/fetch.d.ts +209 -0
- data/payload/node_modules/undici-types/file.d.ts +39 -0
- data/payload/node_modules/undici-types/filereader.d.ts +54 -0
- data/payload/node_modules/undici-types/formdata.d.ts +108 -0
- data/payload/node_modules/undici-types/global-dispatcher.d.ts +9 -0
- data/payload/node_modules/undici-types/global-origin.d.ts +7 -0
- data/payload/node_modules/undici-types/handlers.d.ts +15 -0
- data/payload/node_modules/undici-types/header.d.ts +4 -0
- data/payload/node_modules/undici-types/index.d.ts +71 -0
- data/payload/node_modules/undici-types/interceptors.d.ts +17 -0
- data/payload/node_modules/undici-types/mock-agent.d.ts +50 -0
- data/payload/node_modules/undici-types/mock-client.d.ts +25 -0
- data/payload/node_modules/undici-types/mock-errors.d.ts +12 -0
- data/payload/node_modules/undici-types/mock-interceptor.d.ts +93 -0
- data/payload/node_modules/undici-types/mock-pool.d.ts +25 -0
- data/payload/node_modules/undici-types/package.json +55 -0
- data/payload/node_modules/undici-types/patch.d.ts +33 -0
- data/payload/node_modules/undici-types/pool-stats.d.ts +19 -0
- data/payload/node_modules/undici-types/pool.d.ts +39 -0
- data/payload/node_modules/undici-types/proxy-agent.d.ts +28 -0
- data/payload/node_modules/undici-types/readable.d.ts +65 -0
- data/payload/node_modules/undici-types/retry-agent.d.ts +8 -0
- data/payload/node_modules/undici-types/retry-handler.d.ts +116 -0
- data/payload/node_modules/undici-types/util.d.ts +18 -0
- data/payload/node_modules/undici-types/webidl.d.ts +228 -0
- data/payload/node_modules/undici-types/websocket.d.ts +150 -0
- data/payload/node_modules/widest-line/index.d.ts +21 -0
- data/payload/node_modules/widest-line/index.js +16 -0
- data/payload/node_modules/widest-line/license +9 -0
- data/payload/node_modules/widest-line/package.json +54 -0
- data/payload/node_modules/widest-line/readme.md +34 -0
- data/payload/node_modules/wordwrap/LICENSE +18 -0
- data/payload/node_modules/wordwrap/README.markdown +70 -0
- data/payload/node_modules/wordwrap/example/center.js +10 -0
- data/payload/node_modules/wordwrap/example/meat.js +3 -0
- data/payload/node_modules/wordwrap/index.js +76 -0
- data/payload/node_modules/wordwrap/package.json +34 -0
- data/payload/node_modules/wordwrap/test/break.js +32 -0
- data/payload/node_modules/wordwrap/test/idleness.txt +63 -0
- data/payload/node_modules/wordwrap/test/wrap.js +33 -0
- data/payload/node_modules/wrap-ansi/index.js +186 -0
- data/payload/node_modules/wrap-ansi/license +9 -0
- data/payload/node_modules/wrap-ansi/package.json +61 -0
- data/payload/node_modules/wrap-ansi/readme.md +97 -0
- data/payload/node_modules/wsl-utils/index.d.ts +180 -0
- data/payload/node_modules/wsl-utils/index.js +140 -0
- data/payload/node_modules/wsl-utils/license +9 -0
- data/payload/node_modules/wsl-utils/package.json +48 -0
- data/payload/node_modules/wsl-utils/readme.md +223 -0
- data/payload/node_modules/wsl-utils/utilities.js +19 -0
- data/payload/node_modules/yoctocolors-cjs/index.d.ts +94 -0
- data/payload/node_modules/yoctocolors-cjs/index.js +98 -0
- data/payload/node_modules/yoctocolors-cjs/license +9 -0
- data/payload/node_modules/yoctocolors-cjs/package.json +67 -0
- data/payload/node_modules/yoctocolors-cjs/readme.md +130 -0
- data/payload/oclif.manifest.json +793 -0
- data/payload/package.json +80 -0
- metadata +809 -35
- data/Gemfile +0 -19
- data/Gemfile.lock +0 -78
- data/LICENSE.md +0 -7
- data/bin/avo +0 -9
- data/bin/rspec +0 -4
- data/lib/avo_cli/cli.rb +0 -60
- data/lib/avo_cli/rules/base.rb +0 -31
- data/lib/avo_cli/rules/fields_as_class_methods.rb +0 -14
- data/lib/avo_cli/scanner.rb +0 -42
- data/lib/avo_cli/scanners/base.rb +0 -13
- data/lib/avo_cli/scanners/resource_scanner.rb +0 -27
- data/lib/avo_cli/version.rb +0 -3
- data/lib/avo_cli.rb +0 -23
- data/lib/support.rb +0 -52
- data/linter.png +0 -0
- data/readme.md +0 -40
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { failedRequest, failedResponse } from './errors.js';
|
|
2
|
+
const DEFAULT_TIMEOUT_MS = 30_000;
|
|
3
|
+
// All the CLI knows about avo-api: the URL shape `/api/resources/<version>/<path>` (the default mount), a Bearer
|
|
4
|
+
// token, and JSON both ways.
|
|
5
|
+
export class Client {
|
|
6
|
+
options;
|
|
7
|
+
constructor(options) {
|
|
8
|
+
this.options = options;
|
|
9
|
+
}
|
|
10
|
+
get(path, query) {
|
|
11
|
+
return this.request('GET', path, { query });
|
|
12
|
+
}
|
|
13
|
+
async request(method, path, { body, query } = {}) {
|
|
14
|
+
const timeoutMs = this.options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
15
|
+
const url = this.url(path, query);
|
|
16
|
+
const headers = {
|
|
17
|
+
Accept: 'application/json',
|
|
18
|
+
Authorization: `Bearer ${this.options.token}`,
|
|
19
|
+
};
|
|
20
|
+
if (body !== undefined)
|
|
21
|
+
headers['Content-Type'] = 'application/json';
|
|
22
|
+
this.options.log?.(`> ${method} ${url}`);
|
|
23
|
+
const started = performance.now();
|
|
24
|
+
let response;
|
|
25
|
+
let raw;
|
|
26
|
+
try {
|
|
27
|
+
response = await fetch(url, {
|
|
28
|
+
body: body === undefined ? undefined : JSON.stringify(body),
|
|
29
|
+
headers,
|
|
30
|
+
method,
|
|
31
|
+
// fetch drops the token when it follows a redirect to another origin, so a 3xx is reported, not followed.
|
|
32
|
+
redirect: 'manual',
|
|
33
|
+
signal: AbortSignal.timeout(timeoutMs),
|
|
34
|
+
});
|
|
35
|
+
// Inside the same `try`: the timeout aborts the body stream too, so an app that stalls after its headers fails here.
|
|
36
|
+
raw = await response.text();
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
throw failedRequest(error, url, timeoutMs);
|
|
40
|
+
}
|
|
41
|
+
const elapsed = Math.round(performance.now() - started);
|
|
42
|
+
this.options.log?.(`< ${response.status} ${response.statusText} (${Buffer.byteLength(raw)} bytes, ${elapsed} ms)`);
|
|
43
|
+
const result = {
|
|
44
|
+
body: parseJson(raw, response.headers),
|
|
45
|
+
headers: response.headers,
|
|
46
|
+
raw,
|
|
47
|
+
status: response.status,
|
|
48
|
+
url,
|
|
49
|
+
};
|
|
50
|
+
if (!response.ok)
|
|
51
|
+
throw failedResponse(result, method);
|
|
52
|
+
return result;
|
|
53
|
+
}
|
|
54
|
+
url(path, query) {
|
|
55
|
+
const segments = path.map((segment) => encodeURIComponent(segment)).join('/');
|
|
56
|
+
const url = new URL(`${this.options.host}/api/resources/${this.options.apiVersion}/${segments}`);
|
|
57
|
+
for (const [key, value] of Object.entries(query ?? {})) {
|
|
58
|
+
if (value !== undefined)
|
|
59
|
+
url.searchParams.set(key, String(value));
|
|
60
|
+
}
|
|
61
|
+
return url.toString();
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
// Parsed only when the server said it is JSON, so an HTML error page from the wrong app is `undefined`, which the
|
|
65
|
+
// caller reads as "not an avo-api answer", rather than a SyntaxError.
|
|
66
|
+
function parseJson(raw, headers) {
|
|
67
|
+
if (raw === '')
|
|
68
|
+
return undefined;
|
|
69
|
+
if (!headers.get('content-type')?.includes('json'))
|
|
70
|
+
return undefined;
|
|
71
|
+
try {
|
|
72
|
+
return JSON.parse(raw);
|
|
73
|
+
}
|
|
74
|
+
catch {
|
|
75
|
+
return undefined;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { readData } from '../data.js';
|
|
2
|
+
import { RecordCommand } from '../record-command.js';
|
|
3
|
+
import { WriteCommand } from '../write-command.js';
|
|
4
|
+
export default class Create extends WriteCommand {
|
|
5
|
+
static args = {
|
|
6
|
+
resource: RecordCommand.resourceArg,
|
|
7
|
+
};
|
|
8
|
+
static description = 'Create a record from one JSON object of fields';
|
|
9
|
+
static examples = [
|
|
10
|
+
`<%= config.bin %> create users --data '{"name": "Ada Lovelace", "email": "ada@example.com"}'`,
|
|
11
|
+
`<%= config.bin %> create users --data '{"name": "Ada", "active": true, "roles": ["editor", "reviewer"]}'`,
|
|
12
|
+
`<%= config.bin %> create comments --data '{"body": "Hi", "commentable_type": "Post", "commentable_id": 7}'`,
|
|
13
|
+
'<%= config.bin %> create users --data @user.json',
|
|
14
|
+
'<%= config.bin %> create users --data - < user.json',
|
|
15
|
+
`<%= config.bin %> create users --data '{"name": "Ada"}' --format json`,
|
|
16
|
+
];
|
|
17
|
+
static hiddenAliases = ['c'];
|
|
18
|
+
async run() {
|
|
19
|
+
const { args, flags } = await this.parse(Create);
|
|
20
|
+
// The client first, so `--data -` does not wait on stdin for a line with no host. Neither step sends anything.
|
|
21
|
+
const client = this.client(flags);
|
|
22
|
+
const data = await readData(flags.data);
|
|
23
|
+
const response = await this.sendFields(client, { method: 'POST', view: 'create' }, [args.resource], data);
|
|
24
|
+
this.printRecord(response, flags);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { RecordCommand } from '../record-command.js';
|
|
2
|
+
export default class Delete extends RecordCommand {
|
|
3
|
+
static args = {
|
|
4
|
+
resource: RecordCommand.resourceArg,
|
|
5
|
+
id: RecordCommand.idArg,
|
|
6
|
+
};
|
|
7
|
+
static description = 'Delete a record';
|
|
8
|
+
static examples = ['<%= config.bin %> delete users 5', '<%= config.bin %> delete users 5 --format json'];
|
|
9
|
+
static hiddenAliases = ['d'];
|
|
10
|
+
// No confirmation: an agent or a CI job has no terminal to answer a prompt on, and a `--yes` typed on every line
|
|
11
|
+
// guards nothing. The line names the record; that is the intent.
|
|
12
|
+
async run() {
|
|
13
|
+
const { args, flags } = await this.parse(Delete);
|
|
14
|
+
const client = this.client(flags);
|
|
15
|
+
// No body, so no view to read first: one request.
|
|
16
|
+
const response = await client.request('DELETE', [args.resource, args.id]);
|
|
17
|
+
if (this.printedJson(flags, response))
|
|
18
|
+
return;
|
|
19
|
+
const { message } = (response.body ?? {});
|
|
20
|
+
this.log(message ?? `Deleted ${args.resource} ${args.id}.`);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { RecordCommand } from '../record-command.js';
|
|
2
|
+
export default class Get extends RecordCommand {
|
|
3
|
+
static args = {
|
|
4
|
+
resource: RecordCommand.resourceArg,
|
|
5
|
+
id: RecordCommand.idArg,
|
|
6
|
+
};
|
|
7
|
+
static description = 'Show one record';
|
|
8
|
+
static examples = [
|
|
9
|
+
'<%= config.bin %> get users 5',
|
|
10
|
+
'<%= config.bin %> get users 5 --fields name,email',
|
|
11
|
+
'<%= config.bin %> get users 5 --format json',
|
|
12
|
+
];
|
|
13
|
+
static flags = { fields: RecordCommand.fieldsFlag };
|
|
14
|
+
static hiddenAliases = ['g'];
|
|
15
|
+
async run() {
|
|
16
|
+
const { args, flags } = await this.parse(Get);
|
|
17
|
+
this.printRecord(await this.client(flags).get([args.resource, args.id]), flags);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Flags } from '@oclif/core';
|
|
2
|
+
import { wrongShape } from '../errors.js';
|
|
3
|
+
import { RecordCommand } from '../record-command.js';
|
|
4
|
+
import { renderTable } from '../table.js';
|
|
5
|
+
export default class List extends RecordCommand {
|
|
6
|
+
static args = { resource: RecordCommand.resourceArg };
|
|
7
|
+
static description = 'List the records of a resource, one page at a time';
|
|
8
|
+
static examples = [
|
|
9
|
+
'<%= config.bin %> list users',
|
|
10
|
+
'<%= config.bin %> list users --page 2 --per-page 10',
|
|
11
|
+
'<%= config.bin %> list users --sort name --dir desc',
|
|
12
|
+
'<%= config.bin %> list users --fields id,name,email',
|
|
13
|
+
'<%= config.bin %> list users --format json',
|
|
14
|
+
];
|
|
15
|
+
static flags = {
|
|
16
|
+
dir: Flags.string({ dependsOn: ['sort'], description: 'Sort direction: asc or desc' }),
|
|
17
|
+
fields: RecordCommand.fieldsFlag,
|
|
18
|
+
page: Flags.integer({ description: 'Page number, starting at 1' }),
|
|
19
|
+
'per-page': Flags.integer({ description: "Records per page (default: the app's Avo setting)" }),
|
|
20
|
+
sort: Flags.string({ description: 'Field to sort by' }),
|
|
21
|
+
};
|
|
22
|
+
static hiddenAliases = ['l'];
|
|
23
|
+
async run() {
|
|
24
|
+
const { args, flags } = await this.parse(List);
|
|
25
|
+
const client = this.client(flags);
|
|
26
|
+
const response = await client.get([args.resource], {
|
|
27
|
+
page: flags.page,
|
|
28
|
+
per_page: flags['per-page'],
|
|
29
|
+
sort_by: flags.sort,
|
|
30
|
+
sort_direction: flags.dir,
|
|
31
|
+
});
|
|
32
|
+
// Before `parseRecords`: `--format json` must relay a body this command could not table.
|
|
33
|
+
if (this.printedJson(flags, response))
|
|
34
|
+
return;
|
|
35
|
+
const { pagination, records } = parseRecords(response);
|
|
36
|
+
this.log(records.length === 0 ? `No ${args.resource} records.` : renderTable(records, flags.fields));
|
|
37
|
+
if (typeof pagination?.page === 'number') {
|
|
38
|
+
this.log(`Page ${pagination.page} of ${pagination.total_pages} (${pagination.total_count} records)`);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function parseRecords(response) {
|
|
43
|
+
const body = response.body;
|
|
44
|
+
if (!Array.isArray(body?.records))
|
|
45
|
+
throw wrongShape(response.url, 'records');
|
|
46
|
+
return { pagination: body.pagination, records: body.records };
|
|
47
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import input from '@inquirer/input';
|
|
2
|
+
import password from '@inquirer/password';
|
|
3
|
+
import { ConnectionCommand } from '../base-command.js';
|
|
4
|
+
import { checkToken, DEFAULT_API_VERSION, normalizeHost, resolveConfig } from '../config.js';
|
|
5
|
+
import { CliError } from '../errors.js';
|
|
6
|
+
import { loadSchema } from '../schema.js';
|
|
7
|
+
import { fileIn, save } from '../store.js';
|
|
8
|
+
export default class Login extends ConnectionCommand {
|
|
9
|
+
static description = 'Save a host, an API token and the API version, so later commands need none of them';
|
|
10
|
+
static examples = [
|
|
11
|
+
'<%= config.bin %> login',
|
|
12
|
+
'<%= config.bin %> login --host http://localhost:3000',
|
|
13
|
+
'<%= config.bin %> login --host http://localhost:3000 --token avo_...',
|
|
14
|
+
'<%= config.bin %> login --api-version v2',
|
|
15
|
+
];
|
|
16
|
+
// On stderr, like any prompt: `avo login > log` still shows the questions, and the log gets only the result.
|
|
17
|
+
static prompts = {
|
|
18
|
+
input: (config) => input(config, { output: process.stderr }),
|
|
19
|
+
isTTY: () => Boolean(process.stdin.isTTY),
|
|
20
|
+
password: (config) => password(config, { output: process.stderr }),
|
|
21
|
+
};
|
|
22
|
+
async run() {
|
|
23
|
+
const { flags } = await this.parse(Login);
|
|
24
|
+
const connection = resolveConfig(await this.collect(flags));
|
|
25
|
+
// Through the same client every other command uses, so nothing is saved that the next `avo list` could not use.
|
|
26
|
+
await loadSchema(this.clientFor(connection, flags.verbose));
|
|
27
|
+
this.log(`Checking ${connection.host} (API ${connection.apiVersion}) ... ok.`);
|
|
28
|
+
const file = fileIn(this.config.configDir);
|
|
29
|
+
const replaced = save(this.config.configDir, connection);
|
|
30
|
+
this.log(`Saved to ${file}${replaced ? ' (replaced the previous one).' : '.'}`);
|
|
31
|
+
}
|
|
32
|
+
async askHost() {
|
|
33
|
+
this.requireTerminal('host', '--host', 'AVO_API_HOST');
|
|
34
|
+
// Normalized with the rest in `resolveConfig`; the prompt has already accepted it.
|
|
35
|
+
return Login.prompts.input({
|
|
36
|
+
message: 'Host (e.g. http://localhost:3000):',
|
|
37
|
+
validate: problemWith(normalizeHost),
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
async askToken() {
|
|
41
|
+
this.requireTerminal('token', '--token', 'AVO_API_TOKEN');
|
|
42
|
+
return Login.prompts.password({
|
|
43
|
+
mask: true,
|
|
44
|
+
message: 'API token:',
|
|
45
|
+
validate: (value) => (value.length > 0 ? problemWith(checkToken)(value) : 'The token cannot be empty.'),
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
// The version has a default, so without a terminal it is taken rather than refused: CI gives host and token only.
|
|
49
|
+
async askVersion() {
|
|
50
|
+
if (!Login.prompts.isTTY())
|
|
51
|
+
return DEFAULT_API_VERSION;
|
|
52
|
+
return Login.prompts.input({
|
|
53
|
+
default: DEFAULT_API_VERSION,
|
|
54
|
+
message: 'API version:',
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
// A value given by flag or env is an answer already, so only the rest is asked for. The answers are raw, for
|
|
58
|
+
// `resolveConfig`; a bad `--host` is checked here only so it fails before the token is asked for.
|
|
59
|
+
async collect(flags) {
|
|
60
|
+
try {
|
|
61
|
+
if (flags.host)
|
|
62
|
+
normalizeHost(flags.host);
|
|
63
|
+
const host = flags.host || (await this.askHost());
|
|
64
|
+
const token = flags.token || (await this.askToken());
|
|
65
|
+
const apiVersion = flags['api-version'] || (await this.askVersion());
|
|
66
|
+
return { 'api-version': apiVersion, host, token };
|
|
67
|
+
}
|
|
68
|
+
catch (error) {
|
|
69
|
+
// Ctrl-C is a decision not to log in, not a failure to report back. 130 is the shell's code for it.
|
|
70
|
+
if (error.name === 'ExitPromptError')
|
|
71
|
+
this.exit(130);
|
|
72
|
+
throw error;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
requireTerminal(what, flag, env) {
|
|
76
|
+
if (Login.prompts.isTTY())
|
|
77
|
+
return;
|
|
78
|
+
throw CliError.usage(`No ${what}. \`avo login\` cannot ask without a terminal; pass ${flag} or set ${env}.`);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
// Turns the check `resolveConfig` runs into a prompt's own, so a bad answer is asked again with the reason rather
|
|
82
|
+
// than failing only after every question.
|
|
83
|
+
function problemWith(check) {
|
|
84
|
+
return (value) => {
|
|
85
|
+
try {
|
|
86
|
+
check(value);
|
|
87
|
+
return true;
|
|
88
|
+
}
|
|
89
|
+
catch (error) {
|
|
90
|
+
return error.message;
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
import { fileIn, remove } from '../store.js';
|
|
3
|
+
// Not a `BaseCommand`: it makes no request, so the connection flags would be on `--help` doing nothing.
|
|
4
|
+
export default class Logout extends Command {
|
|
5
|
+
static description = 'Delete the saved host and token. AVO_API_HOST and AVO_API_TOKEN set in the environment are not affected';
|
|
6
|
+
static examples = ['<%= config.bin %> logout'];
|
|
7
|
+
async run() {
|
|
8
|
+
// Nothing to read from it: parsing is what refuses a flag this command does not have, instead of ignoring it.
|
|
9
|
+
await this.parse(Logout);
|
|
10
|
+
const { configDir } = this.config;
|
|
11
|
+
this.log(remove(configDir) ? `Deleted ${fileIn(configDir)}.` : 'Nothing to delete: no host and token were saved.');
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { Args, Flags } from '@oclif/core';
|
|
2
|
+
import { BaseCommand } from '../base-command.js';
|
|
3
|
+
import { CliError } from '../errors.js';
|
|
4
|
+
import { DEFAULT_VIEW, fetchResourceSchema, loadSchema } from '../schema.js';
|
|
5
|
+
import { renderTable } from '../table.js';
|
|
6
|
+
// One verb, two answers: with no resource, the resources the API serves and
|
|
7
|
+
// how far the token reaches on each; with one, its fields on one view.
|
|
8
|
+
export default class Schema extends BaseCommand {
|
|
9
|
+
static args = {
|
|
10
|
+
resource: Args.string({
|
|
11
|
+
description: 'A resource by its route key; with none, the resources the API serves are listed',
|
|
12
|
+
}),
|
|
13
|
+
};
|
|
14
|
+
static description = 'List the resources the API serves, or the fields of one resource on one view';
|
|
15
|
+
static examples = [
|
|
16
|
+
'<%= config.bin %> schema',
|
|
17
|
+
'<%= config.bin %> schema --format json',
|
|
18
|
+
'<%= config.bin %> schema users',
|
|
19
|
+
'<%= config.bin %> schema users --view show',
|
|
20
|
+
'<%= config.bin %> schema --host http://localhost:3000 --token avo_...',
|
|
21
|
+
];
|
|
22
|
+
static flags = {
|
|
23
|
+
// No `options`: the view names are the API's to know, not this flag's.
|
|
24
|
+
view: Flags.string({
|
|
25
|
+
description: `Which view's fields: create/update list what a write may send, with required; index/show what a record reads back (default: ${DEFAULT_VIEW})`,
|
|
26
|
+
}),
|
|
27
|
+
};
|
|
28
|
+
static hiddenAliases = ['s'];
|
|
29
|
+
async run() {
|
|
30
|
+
const { args, flags } = await this.parse(Schema);
|
|
31
|
+
const { resource } = args;
|
|
32
|
+
// A usage error, so it comes before the host and token are looked for.
|
|
33
|
+
if (resource === undefined && flags.view) {
|
|
34
|
+
throw CliError.usage('--view needs a resource: `schema users --view show`.');
|
|
35
|
+
}
|
|
36
|
+
const client = this.client(flags);
|
|
37
|
+
if (resource === undefined) {
|
|
38
|
+
await this.listResources(client, flags);
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
const asked = flags.view ?? DEFAULT_VIEW;
|
|
42
|
+
const { response, schema } = await fetchResourceSchema(client, resource, asked);
|
|
43
|
+
if (this.printedJson(flags, response))
|
|
44
|
+
return;
|
|
45
|
+
const { fields } = schema;
|
|
46
|
+
this.log(fields.length === 0 ? `No fields on the ${asked} view of ${resource}.` : renderTable(fields));
|
|
47
|
+
}
|
|
48
|
+
async listResources(client, flags) {
|
|
49
|
+
const { response, schema } = await loadSchema(client);
|
|
50
|
+
if (this.printedJson(flags, response))
|
|
51
|
+
return;
|
|
52
|
+
if (schema.resources.length === 0) {
|
|
53
|
+
this.log(`No resources: nothing API ${schema.api_version} serves is within this token's entitlements.`);
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
this.log(renderTable(schema.resources, ['route_key', 'name', 'entitlements', 'avo_actions']));
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { readData } from '../data.js';
|
|
2
|
+
import { RecordCommand } from '../record-command.js';
|
|
3
|
+
import { WriteCommand } from '../write-command.js';
|
|
4
|
+
export default class Update extends WriteCommand {
|
|
5
|
+
static args = {
|
|
6
|
+
resource: RecordCommand.resourceArg,
|
|
7
|
+
id: RecordCommand.idArg,
|
|
8
|
+
};
|
|
9
|
+
static description = 'Update a record from one JSON object of fields; every field not given is left as it is';
|
|
10
|
+
static examples = [
|
|
11
|
+
`<%= config.bin %> update users 5 --data '{"name": "Ada King"}'`,
|
|
12
|
+
`<%= config.bin %> update users 5 --data '{"active": false, "age": 36}'`,
|
|
13
|
+
`<%= config.bin %> update users 5 --data '{"bio": null, "roles": []}'`,
|
|
14
|
+
'<%= config.bin %> update users 5 --data @user.json',
|
|
15
|
+
'<%= config.bin %> update users 5 --data - < user.json',
|
|
16
|
+
`<%= config.bin %> update users 5 --data '{"name": "Ada"}' --format json`,
|
|
17
|
+
];
|
|
18
|
+
static hiddenAliases = ['u'];
|
|
19
|
+
async run() {
|
|
20
|
+
const { args, flags } = await this.parse(Update);
|
|
21
|
+
// The client first, so `--data -` does not wait on stdin for a line with no host. Neither step sends anything.
|
|
22
|
+
const client = this.client(flags);
|
|
23
|
+
const data = await readData(flags.data);
|
|
24
|
+
const response = await this.sendFields(client, { method: 'PATCH', view: 'update' }, [args.resource, args.id], data);
|
|
25
|
+
this.printRecord(response, flags);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { CliError } from './errors.js';
|
|
2
|
+
import { exists, read } from './store.js';
|
|
3
|
+
export const DEFAULT_API_VERSION = 'v1';
|
|
4
|
+
// Fails fast on the two values that have no default. A saved login (`configDir`) is used all or nothing: a flag naming
|
|
5
|
+
// either value skips the file, so a saved token never reaches another host and a broken file cannot fail the command.
|
|
6
|
+
export function resolveConfig(flags, configDir) {
|
|
7
|
+
const given = Boolean(flags.host || flags.token);
|
|
8
|
+
const saved = (given || !configDir ? undefined : read(configDir)) ?? {};
|
|
9
|
+
const host = flags.host || saved.host;
|
|
10
|
+
const token = flags.token || saved.token;
|
|
11
|
+
// Asked only on failure, so the error names the ignored file rather than sending the customer back to `avo login`.
|
|
12
|
+
const ignoredSaved = () => given && configDir !== undefined && exists(configDir);
|
|
13
|
+
if (!host) {
|
|
14
|
+
throw CliError.usage(ignoredSaved()
|
|
15
|
+
? 'No host. The saved login was ignored because a token was given without a host. Pass --host or set ' +
|
|
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. http://localhost:3000), set AVO_API_HOST, or run `avo login`.');
|
|
18
|
+
}
|
|
19
|
+
if (!token) {
|
|
20
|
+
throw CliError.usage(ignoredSaved()
|
|
21
|
+
? 'No token. The saved login was ignored because a host was given without a token. Pass --token or set ' +
|
|
22
|
+
'AVO_API_TOKEN too, or drop --host and unset AVO_API_HOST to use the saved login.'
|
|
23
|
+
: 'No token. Pass --token, set AVO_API_TOKEN to an API token secret, or run `avo login`.');
|
|
24
|
+
}
|
|
25
|
+
checkToken(token);
|
|
26
|
+
return {
|
|
27
|
+
// `||`, not `??`: `--api-version "$VER"` with the variable unset arrives empty, and an empty URL segment 404s.
|
|
28
|
+
apiVersion: flags['api-version'] || saved.apiVersion || DEFAULT_API_VERSION,
|
|
29
|
+
host: normalizeHost(host),
|
|
30
|
+
token,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
// fetch quotes a header value it refuses in its error, so a token it cannot send is refused here, unquoted.
|
|
34
|
+
export function checkToken(token) {
|
|
35
|
+
if (/[^\u0020-\u007E]/.test(token)) {
|
|
36
|
+
throw CliError.usage('The token has a character that cannot be sent in a header, such as a newline.');
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
// 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. A trailing slash is dropped so the path appends cleanly.
|
|
41
|
+
export function normalizeHost(host) {
|
|
42
|
+
let url;
|
|
43
|
+
try {
|
|
44
|
+
url = new URL(host);
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
throw CliError.usage(`Host must be a URL, e.g. http://localhost:3000 (got "${host}")`);
|
|
48
|
+
}
|
|
49
|
+
if (url.protocol !== 'http:' && url.protocol !== 'https:') {
|
|
50
|
+
throw CliError.usage(`Host must start with http:// or https:// (got "${host}")`);
|
|
51
|
+
}
|
|
52
|
+
// `origin` would drop them in silence, and the 401 that follows would blame the token. Not quoted: it is a secret.
|
|
53
|
+
if (url.username || url.password) {
|
|
54
|
+
throw CliError.usage('Host cannot carry a username and password: basic auth in the URL is not supported.');
|
|
55
|
+
}
|
|
56
|
+
return url.origin + url.pathname.replace(/\/+$/, '');
|
|
57
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { readFile } from 'node:fs/promises';
|
|
2
|
+
import { text } from 'node:stream/consumers';
|
|
3
|
+
import { CliError } from './errors.js';
|
|
4
|
+
// Only the outer shape is checked: it parsed, and it is one object. An empty object goes out like any other, since
|
|
5
|
+
// what sets nothing is the API's to refuse. A list would be a batch, which does not exist yet.
|
|
6
|
+
export async function readData(given, stdin = process.stdin) {
|
|
7
|
+
const data = parse(await read(given, stdin));
|
|
8
|
+
if (typeof data !== 'object' || data === null || Array.isArray(data)) {
|
|
9
|
+
throw CliError.usage('--data takes one JSON object, such as {"name": "Ada"}.');
|
|
10
|
+
}
|
|
11
|
+
return data;
|
|
12
|
+
}
|
|
13
|
+
async function read(given, stdin) {
|
|
14
|
+
if (given === '-')
|
|
15
|
+
return text(stdin);
|
|
16
|
+
if (!given.startsWith('@'))
|
|
17
|
+
return given;
|
|
18
|
+
const path = given.slice(1);
|
|
19
|
+
try {
|
|
20
|
+
return await readFile(path, 'utf8');
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
throw CliError.usage(`--data could not read the file ${path}: ${error.message}`);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function parse(json) {
|
|
27
|
+
try {
|
|
28
|
+
return JSON.parse(json);
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
throw CliError.usage(`--data is not valid JSON: ${error.message}. For quoting trouble, use --data @file.json.`);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { Errors } from '@oclif/core';
|
|
2
|
+
// oclif prints it and exits with the code it carries: 1 when the request failed, 2 when the caller got the invocation
|
|
3
|
+
// wrong. 130 is not raised through here: `login` exits with it directly on Ctrl-C at a prompt.
|
|
4
|
+
export class CliError extends Errors.CLIError {
|
|
5
|
+
constructor(message, exitCode = 1) {
|
|
6
|
+
super(message, { exit: exitCode });
|
|
7
|
+
}
|
|
8
|
+
static usage(message) {
|
|
9
|
+
return new CliError(message, 2);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
// `status` and `reason` are the contract; a server `message` is used wherever one is sent. A 404 is always worded
|
|
13
|
+
// here, since no 404 body names its cause.
|
|
14
|
+
export function failedResponse(response, method) {
|
|
15
|
+
const { status, url } = response;
|
|
16
|
+
const body = (typeof response.body === 'object' && response.body !== null ? response.body : {});
|
|
17
|
+
const { origin, pathname } = new URL(url);
|
|
18
|
+
if (status >= 300 && status < 400)
|
|
19
|
+
return new CliError(redirected(response, origin));
|
|
20
|
+
if (status === 401)
|
|
21
|
+
return new CliError(unauthorized(body.message, origin));
|
|
22
|
+
if (status === 403)
|
|
23
|
+
return new CliError(forbidden(body, `${method} ${pathname}`));
|
|
24
|
+
if (status === 404)
|
|
25
|
+
return new CliError(notFound(response, origin));
|
|
26
|
+
if (status === 422)
|
|
27
|
+
return new CliError(validationFailed(body));
|
|
28
|
+
if (status >= 500)
|
|
29
|
+
return new CliError(withDetail(`Server error ${status} from ${url}.`, body));
|
|
30
|
+
return new CliError(withDetail(`HTTP ${status} from ${url}.`, body));
|
|
31
|
+
}
|
|
32
|
+
// A success whose body is not the shape the endpoint promises, typically a different app on the port.
|
|
33
|
+
export function wrongShape(source, expected) {
|
|
34
|
+
return new CliError(`${source} did not answer with ${expected}. Is this an app running avo-api?`);
|
|
35
|
+
}
|
|
36
|
+
// `fetch` wraps the network error as the `cause` of a bare "fetch failed", so the useful part is one level down.
|
|
37
|
+
export function failedRequest(error, url, timeoutMs) {
|
|
38
|
+
const { hostname, origin } = new URL(url);
|
|
39
|
+
const { cause, name } = error;
|
|
40
|
+
if (name === 'TimeoutError' || name === 'AbortError') {
|
|
41
|
+
return new CliError(`Timed out after ${timeoutMs / 1000}s waiting for ${url}.`);
|
|
42
|
+
}
|
|
43
|
+
if (cause?.code === 'ECONNREFUSED') {
|
|
44
|
+
return new CliError(`Connection refused by ${origin}. Is the app running there?`);
|
|
45
|
+
}
|
|
46
|
+
if (cause?.code === 'ENOTFOUND' || cause?.code === 'EAI_AGAIN') {
|
|
47
|
+
return new CliError(`Unknown host ${hostname}. Check --host, AVO_API_HOST, or the host \`avo login\` saved.`);
|
|
48
|
+
}
|
|
49
|
+
const detail = cause?.message ?? error.message;
|
|
50
|
+
return new CliError(`Request to ${url} failed: ${detail}`);
|
|
51
|
+
}
|
|
52
|
+
// Typically `force_ssl` answering an http host. Following it would send the request on without the token.
|
|
53
|
+
function redirected(response, origin) {
|
|
54
|
+
const location = response.headers.get('location');
|
|
55
|
+
return `${origin} redirected${location ? ` to ${location}` : ''}. Use the address it points to as the host.`;
|
|
56
|
+
}
|
|
57
|
+
// The server cannot know where the token came from, so the hint follows whichever side worded the sentence.
|
|
58
|
+
function unauthorized(message, origin) {
|
|
59
|
+
return `${message ?? `Unauthorized: ${origin} rejected the token.`} Check --token, AVO_API_TOKEN, or run \`avo login\` again.`;
|
|
60
|
+
}
|
|
61
|
+
// `reason` is relayed as it came: only the server knows whether to widen the token or the policy. Not `withDetail`:
|
|
62
|
+
// it falls back to `error`, which on this status is the word "Forbidden" again.
|
|
63
|
+
function forbidden(body, request) {
|
|
64
|
+
const reason = body.reason ? ` (reason: ${body.reason})` : '';
|
|
65
|
+
return [`Forbidden: ${request} was refused${reason}.`, body.message].filter(Boolean).join(' ');
|
|
66
|
+
}
|
|
67
|
+
// A wrong resource name, a wrong API version, an unmounted and an unlicensed app all answer 404, so the message lists
|
|
68
|
+
// all four; a missing record does too, and only the URL line covers it. A non-JSON body hints at the wrong app.
|
|
69
|
+
function notFound(response, origin) {
|
|
70
|
+
const lines = [
|
|
71
|
+
`Not found: ${response.url}.`,
|
|
72
|
+
'Check the resource name and the API version, and that the app has avo-api mounted and licensed.',
|
|
73
|
+
];
|
|
74
|
+
if (response.body === undefined) {
|
|
75
|
+
const type = response.headers.get('content-type') ?? 'no content type';
|
|
76
|
+
lines.push(`The response was ${type}, not JSON: is ${origin} the right app?`);
|
|
77
|
+
}
|
|
78
|
+
return lines.join('\n');
|
|
79
|
+
}
|
|
80
|
+
// `errors` is Rails' `record.errors` as JSON: a message list per attribute.
|
|
81
|
+
function validationFailed(body) {
|
|
82
|
+
const lines = [body.message ?? 'Validation failed.'];
|
|
83
|
+
for (const [field, messages] of Object.entries(body.errors ?? {})) {
|
|
84
|
+
lines.push(` ${field}: ${[messages].flat().join(', ')}`);
|
|
85
|
+
}
|
|
86
|
+
return lines.join('\n');
|
|
87
|
+
}
|
|
88
|
+
// Each part is optional, so `views` is relayed even without a sentence.
|
|
89
|
+
function withDetail(message, body) {
|
|
90
|
+
const detail = body.message ?? body.error;
|
|
91
|
+
const known = body.views?.length ? `(known views: ${body.views.join(', ')})` : '';
|
|
92
|
+
return [message, detail, known].filter(Boolean).join(' ');
|
|
93
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { CliError } from '../errors.js';
|
|
2
|
+
import { suggest } from '../suggest.js';
|
|
3
|
+
// oclif collates every word up to the first flag into the id (`users:lst`), so the id read back with spaces is the
|
|
4
|
+
// line as typed. It has to throw: oclif counts any return from this hook, undefined included, as the command run.
|
|
5
|
+
const hook = async function ({ id }) {
|
|
6
|
+
const words = id.split(':');
|
|
7
|
+
const nearest = nearestCommand(words, this.config);
|
|
8
|
+
const lines = [`command ${words.join(' ')} not found`];
|
|
9
|
+
if (nearest)
|
|
10
|
+
lines.push(`Did you mean: ${this.config.bin} ${nearest}?`);
|
|
11
|
+
lines.push(`Usage: ${this.config.bin} <verb> <resource> [id] [flags]`);
|
|
12
|
+
throw CliError.usage(lines.join('\n'));
|
|
13
|
+
};
|
|
14
|
+
// A hidden shortcut is never a candidate. Only the first word is compared, since every command is one word, so the
|
|
15
|
+
// resource and id on the line do not count as edits. A first word that already is a command is no correction.
|
|
16
|
+
function nearestCommand(words, config) {
|
|
17
|
+
const ids = config.commands.filter((command) => !command.hidden).map((command) => command.id);
|
|
18
|
+
const [typed] = words;
|
|
19
|
+
const nearest = suggest(typed, ids);
|
|
20
|
+
return nearest && nearest !== typed ? nearest : undefined;
|
|
21
|
+
}
|
|
22
|
+
export default hook;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { run } from '@oclif/core';
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { CliError } from './errors.js';
|
|
2
|
+
// A value is sent as given and the server validates it: a second copy of the API's rules here would refuse a write a
|
|
3
|
+
// newer server accepts. The schema is read only for a file, and for a value whose wire form differs from its JSON.
|
|
4
|
+
export function buildPayload(data, fields) {
|
|
5
|
+
const payload = {};
|
|
6
|
+
const byId = new Map(fields.map((field) => [field.id, field]));
|
|
7
|
+
for (const [id, value] of Object.entries(data)) {
|
|
8
|
+
payload[id] = onTheWire(byId.get(id), value);
|
|
9
|
+
}
|
|
10
|
+
return payload;
|
|
11
|
+
}
|
|
12
|
+
// `key_value` and `code` take their JSON as a string and parse it themselves; sent as an object, a `key_value` column
|
|
13
|
+
// is wiped.
|
|
14
|
+
const JSON_AS_STRING = new Set(['code', 'key_value']);
|
|
15
|
+
// null clears any field, but strong params silently drop a bare null in place of a list or a hash, so there it becomes
|
|
16
|
+
// what does clear: the empty list, or every key null (both held by avo-api's `field_types_update_test.rb`).
|
|
17
|
+
function onTheWire(field, value) {
|
|
18
|
+
if (!field)
|
|
19
|
+
return value;
|
|
20
|
+
const { id, keys = [], shape, type } = field;
|
|
21
|
+
// Whatever its shape, a file is bytes the JSON body cannot carry.
|
|
22
|
+
if (type === 'file' || type === 'files') {
|
|
23
|
+
throw CliError.usage(`${id} is a ${type} field, and a file needs a multipart upload the CLI does not send.`);
|
|
24
|
+
}
|
|
25
|
+
if (value === null) {
|
|
26
|
+
if (shape === 'array')
|
|
27
|
+
return [];
|
|
28
|
+
if (shape === 'hash')
|
|
29
|
+
return Object.fromEntries(keys.map((key) => [key, null]));
|
|
30
|
+
return value;
|
|
31
|
+
}
|
|
32
|
+
if (typeof value === 'object' && JSON_AS_STRING.has(type))
|
|
33
|
+
return JSON.stringify(value);
|
|
34
|
+
return value;
|
|
35
|
+
}
|