@allstak/wizard 0.1.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.
- package/CHANGELOG.md +90 -0
- package/README.md +79 -0
- package/dist/api/auth-client.d.ts +22 -0
- package/dist/api/auth-client.d.ts.map +1 -0
- package/dist/api/auth-client.js +65 -0
- package/dist/api/auth-client.js.map +1 -0
- package/dist/api/auth.d.ts +39 -0
- package/dist/api/auth.d.ts.map +1 -0
- package/dist/api/auth.js +69 -0
- package/dist/api/auth.js.map +1 -0
- package/dist/api/client.d.ts +15 -0
- package/dist/api/client.d.ts.map +1 -0
- package/dist/api/client.js +19 -0
- package/dist/api/client.js.map +1 -0
- package/dist/api/http.d.ts +44 -0
- package/dist/api/http.d.ts.map +1 -0
- package/dist/api/http.js +130 -0
- package/dist/api/http.js.map +1 -0
- package/dist/api/index.d.ts +12 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/index.js +12 -0
- package/dist/api/index.js.map +1 -0
- package/dist/api/orgs-client.d.ts +16 -0
- package/dist/api/orgs-client.d.ts.map +1 -0
- package/dist/api/orgs-client.js +36 -0
- package/dist/api/orgs-client.js.map +1 -0
- package/dist/api/projects-client.d.ts +27 -0
- package/dist/api/projects-client.d.ts.map +1 -0
- package/dist/api/projects-client.js +58 -0
- package/dist/api/projects-client.js.map +1 -0
- package/dist/api/setup-doctor-client.d.ts +31 -0
- package/dist/api/setup-doctor-client.d.ts.map +1 -0
- package/dist/api/setup-doctor-client.js +68 -0
- package/dist/api/setup-doctor-client.js.map +1 -0
- package/dist/api/types.d.ts +92 -0
- package/dist/api/types.d.ts.map +1 -0
- package/dist/api/types.js +9 -0
- package/dist/api/types.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +303 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/_context.d.ts +37 -0
- package/dist/commands/_context.d.ts.map +1 -0
- package/dist/commands/_context.js +61 -0
- package/dist/commands/_context.js.map +1 -0
- package/dist/commands/config-cmd.d.ts +24 -0
- package/dist/commands/config-cmd.d.ts.map +1 -0
- package/dist/commands/config-cmd.js +137 -0
- package/dist/commands/config-cmd.js.map +1 -0
- package/dist/commands/doctor.d.ts +58 -0
- package/dist/commands/doctor.d.ts.map +1 -0
- package/dist/commands/doctor.js +389 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/init.d.ts +28 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +157 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/list.d.ts +3 -0
- package/dist/commands/list.d.ts.map +1 -0
- package/dist/commands/list.js +14 -0
- package/dist/commands/list.js.map +1 -0
- package/dist/commands/login.d.ts +27 -0
- package/dist/commands/login.d.ts.map +1 -0
- package/dist/commands/login.js +116 -0
- package/dist/commands/login.js.map +1 -0
- package/dist/commands/logout.d.ts +15 -0
- package/dist/commands/logout.d.ts.map +1 -0
- package/dist/commands/logout.js +36 -0
- package/dist/commands/logout.js.map +1 -0
- package/dist/commands/orgs.d.ts +14 -0
- package/dist/commands/orgs.d.ts.map +1 -0
- package/dist/commands/orgs.js +39 -0
- package/dist/commands/orgs.js.map +1 -0
- package/dist/commands/projects.d.ts +21 -0
- package/dist/commands/projects.d.ts.map +1 -0
- package/dist/commands/projects.js +86 -0
- package/dist/commands/projects.js.map +1 -0
- package/dist/commands/repair.d.ts +12 -0
- package/dist/commands/repair.d.ts.map +1 -0
- package/dist/commands/repair.js +45 -0
- package/dist/commands/repair.js.map +1 -0
- package/dist/commands/restore.d.ts +32 -0
- package/dist/commands/restore.d.ts.map +1 -0
- package/dist/commands/restore.js +120 -0
- package/dist/commands/restore.js.map +1 -0
- package/dist/commands/uninstall.d.ts +13 -0
- package/dist/commands/uninstall.d.ts.map +1 -0
- package/dist/commands/uninstall.js +53 -0
- package/dist/commands/uninstall.js.map +1 -0
- package/dist/commands/whoami.d.ts +13 -0
- package/dist/commands/whoami.d.ts.map +1 -0
- package/dist/commands/whoami.js +54 -0
- package/dist/commands/whoami.js.map +1 -0
- package/dist/compat/engine.d.ts +31 -0
- package/dist/compat/engine.d.ts.map +1 -0
- package/dist/compat/engine.js +82 -0
- package/dist/compat/engine.js.map +1 -0
- package/dist/config/define.d.ts +21 -0
- package/dist/config/define.d.ts.map +1 -0
- package/dist/config/define.js +22 -0
- package/dist/config/define.js.map +1 -0
- package/dist/config/index.d.ts +6 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +6 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/loader.d.ts +26 -0
- package/dist/config/loader.d.ts.map +1 -0
- package/dist/config/loader.js +84 -0
- package/dist/config/loader.js.map +1 -0
- package/dist/config/migrations.d.ts +64 -0
- package/dist/config/migrations.d.ts.map +1 -0
- package/dist/config/migrations.js +66 -0
- package/dist/config/migrations.js.map +1 -0
- package/dist/config/precedence.d.ts +24 -0
- package/dist/config/precedence.d.ts.map +1 -0
- package/dist/config/precedence.js +55 -0
- package/dist/config/precedence.js.map +1 -0
- package/dist/config/schema.d.ts +10 -0
- package/dist/config/schema.d.ts.map +1 -0
- package/dist/config/schema.js +140 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/config/types.d.ts +80 -0
- package/dist/config/types.d.ts.map +1 -0
- package/dist/config/types.js +23 -0
- package/dist/config/types.js.map +1 -0
- package/dist/credentials/encrypted-file.d.ts +3 -0
- package/dist/credentials/encrypted-file.d.ts.map +1 -0
- package/dist/credentials/encrypted-file.js +139 -0
- package/dist/credentials/encrypted-file.js.map +1 -0
- package/dist/credentials/error.d.ts +11 -0
- package/dist/credentials/error.d.ts.map +1 -0
- package/dist/credentials/error.js +14 -0
- package/dist/credentials/error.js.map +1 -0
- package/dist/credentials/index.d.ts +20 -0
- package/dist/credentials/index.d.ts.map +1 -0
- package/dist/credentials/index.js +56 -0
- package/dist/credentials/index.js.map +1 -0
- package/dist/credentials/keychain-darwin.d.ts +11 -0
- package/dist/credentials/keychain-darwin.d.ts.map +1 -0
- package/dist/credentials/keychain-darwin.js +88 -0
- package/dist/credentials/keychain-darwin.js.map +1 -0
- package/dist/credentials/keychain-linux.d.ts +13 -0
- package/dist/credentials/keychain-linux.d.ts.map +1 -0
- package/dist/credentials/keychain-linux.js +88 -0
- package/dist/credentials/keychain-linux.js.map +1 -0
- package/dist/credentials/keychain-win.d.ts +13 -0
- package/dist/credentials/keychain-win.d.ts.map +1 -0
- package/dist/credentials/keychain-win.js +31 -0
- package/dist/credentials/keychain-win.js.map +1 -0
- package/dist/credentials/types.d.ts +38 -0
- package/dist/credentials/types.d.ts.map +1 -0
- package/dist/credentials/types.js +5 -0
- package/dist/credentials/types.js.map +1 -0
- package/dist/detect/framework.d.ts +28 -0
- package/dist/detect/framework.d.ts.map +1 -0
- package/dist/detect/framework.js +131 -0
- package/dist/detect/framework.js.map +1 -0
- package/dist/detect/index.d.ts +4 -0
- package/dist/detect/index.d.ts.map +1 -0
- package/dist/detect/index.js +4 -0
- package/dist/detect/index.js.map +1 -0
- package/dist/detect/monorepo.d.ts +10 -0
- package/dist/detect/monorepo.d.ts.map +1 -0
- package/dist/detect/monorepo.js +42 -0
- package/dist/detect/monorepo.js.map +1 -0
- package/dist/detect/package-manager.d.ts +18 -0
- package/dist/detect/package-manager.d.ts.map +1 -0
- package/dist/detect/package-manager.js +60 -0
- package/dist/detect/package-manager.js.map +1 -0
- package/dist/index.d.ts +36 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +38 -0
- package/dist/index.js.map +1 -0
- package/dist/integrations/_scaffold.d.ts +23 -0
- package/dist/integrations/_scaffold.d.ts.map +1 -0
- package/dist/integrations/_scaffold.js +62 -0
- package/dist/integrations/_scaffold.js.map +1 -0
- package/dist/integrations/_shared.d.ts +18 -0
- package/dist/integrations/_shared.d.ts.map +1 -0
- package/dist/integrations/_shared.js +73 -0
- package/dist/integrations/_shared.js.map +1 -0
- package/dist/integrations/_simple-scaffold.d.ts +19 -0
- package/dist/integrations/_simple-scaffold.d.ts.map +1 -0
- package/dist/integrations/_simple-scaffold.js +23 -0
- package/dist/integrations/_simple-scaffold.js.map +1 -0
- package/dist/integrations/dotnet.d.ts +2 -0
- package/dist/integrations/dotnet.d.ts.map +1 -0
- package/dist/integrations/dotnet.js +9 -0
- package/dist/integrations/dotnet.js.map +1 -0
- package/dist/integrations/expo.d.ts +2 -0
- package/dist/integrations/expo.d.ts.map +1 -0
- package/dist/integrations/expo.js +12 -0
- package/dist/integrations/expo.js.map +1 -0
- package/dist/integrations/fastify.d.ts +2 -0
- package/dist/integrations/fastify.d.ts.map +1 -0
- package/dist/integrations/fastify.js +10 -0
- package/dist/integrations/fastify.js.map +1 -0
- package/dist/integrations/flutter.d.ts +2 -0
- package/dist/integrations/flutter.d.ts.map +1 -0
- package/dist/integrations/flutter.js +9 -0
- package/dist/integrations/flutter.js.map +1 -0
- package/dist/integrations/go.d.ts +2 -0
- package/dist/integrations/go.d.ts.map +1 -0
- package/dist/integrations/go.js +9 -0
- package/dist/integrations/go.js.map +1 -0
- package/dist/integrations/java.d.ts +2 -0
- package/dist/integrations/java.d.ts.map +1 -0
- package/dist/integrations/java.js +9 -0
- package/dist/integrations/java.js.map +1 -0
- package/dist/integrations/js/detect.d.ts +3 -0
- package/dist/integrations/js/detect.d.ts.map +1 -0
- package/dist/integrations/js/detect.js +7 -0
- package/dist/integrations/js/detect.js.map +1 -0
- package/dist/integrations/js/doctor.d.ts +3 -0
- package/dist/integrations/js/doctor.d.ts.map +1 -0
- package/dist/integrations/js/doctor.js +38 -0
- package/dist/integrations/js/doctor.js.map +1 -0
- package/dist/integrations/js/files.d.ts +3 -0
- package/dist/integrations/js/files.d.ts.map +1 -0
- package/dist/integrations/js/files.js +19 -0
- package/dist/integrations/js/files.js.map +1 -0
- package/dist/integrations/js/index.d.ts +3 -0
- package/dist/integrations/js/index.d.ts.map +1 -0
- package/dist/integrations/js/index.js +25 -0
- package/dist/integrations/js/index.js.map +1 -0
- package/dist/integrations/js/manifest.d.ts +3 -0
- package/dist/integrations/js/manifest.d.ts.map +1 -0
- package/dist/integrations/js/manifest.js +19 -0
- package/dist/integrations/js/manifest.js.map +1 -0
- package/dist/integrations/js/patch.d.ts +4 -0
- package/dist/integrations/js/patch.d.ts.map +1 -0
- package/dist/integrations/js/patch.js +24 -0
- package/dist/integrations/js/patch.js.map +1 -0
- package/dist/integrations/js/uninstall.d.ts +4 -0
- package/dist/integrations/js/uninstall.d.ts.map +1 -0
- package/dist/integrations/js/uninstall.js +16 -0
- package/dist/integrations/js/uninstall.js.map +1 -0
- package/dist/integrations/nestjs.d.ts +2 -0
- package/dist/integrations/nestjs.d.ts.map +1 -0
- package/dist/integrations/nestjs.js +10 -0
- package/dist/integrations/nestjs.js.map +1 -0
- package/dist/integrations/next/detect.d.ts +3 -0
- package/dist/integrations/next/detect.d.ts.map +1 -0
- package/dist/integrations/next/detect.js +11 -0
- package/dist/integrations/next/detect.js.map +1 -0
- package/dist/integrations/next/doctor.d.ts +3 -0
- package/dist/integrations/next/doctor.d.ts.map +1 -0
- package/dist/integrations/next/doctor.js +46 -0
- package/dist/integrations/next/doctor.js.map +1 -0
- package/dist/integrations/next/files.d.ts +3 -0
- package/dist/integrations/next/files.d.ts.map +1 -0
- package/dist/integrations/next/files.js +19 -0
- package/dist/integrations/next/files.js.map +1 -0
- package/dist/integrations/next/index.d.ts +3 -0
- package/dist/integrations/next/index.d.ts.map +1 -0
- package/dist/integrations/next/index.js +44 -0
- package/dist/integrations/next/index.js.map +1 -0
- package/dist/integrations/next/manifest.d.ts +3 -0
- package/dist/integrations/next/manifest.d.ts.map +1 -0
- package/dist/integrations/next/manifest.js +29 -0
- package/dist/integrations/next/manifest.js.map +1 -0
- package/dist/integrations/next/patch.d.ts +4 -0
- package/dist/integrations/next/patch.d.ts.map +1 -0
- package/dist/integrations/next/patch.js +49 -0
- package/dist/integrations/next/patch.js.map +1 -0
- package/dist/integrations/next/uninstall.d.ts +4 -0
- package/dist/integrations/next/uninstall.d.ts.map +1 -0
- package/dist/integrations/next/uninstall.js +22 -0
- package/dist/integrations/next/uninstall.js.map +1 -0
- package/dist/integrations/otel.d.ts +2 -0
- package/dist/integrations/otel.d.ts.map +1 -0
- package/dist/integrations/otel.js +10 -0
- package/dist/integrations/otel.js.map +1 -0
- package/dist/integrations/php.d.ts +2 -0
- package/dist/integrations/php.d.ts.map +1 -0
- package/dist/integrations/php.js +9 -0
- package/dist/integrations/php.js.map +1 -0
- package/dist/integrations/python.d.ts +2 -0
- package/dist/integrations/python.d.ts.map +1 -0
- package/dist/integrations/python.js +9 -0
- package/dist/integrations/python.js.map +1 -0
- package/dist/integrations/react/detect.d.ts +3 -0
- package/dist/integrations/react/detect.d.ts.map +1 -0
- package/dist/integrations/react/detect.js +11 -0
- package/dist/integrations/react/detect.js.map +1 -0
- package/dist/integrations/react/doctor.d.ts +3 -0
- package/dist/integrations/react/doctor.d.ts.map +1 -0
- package/dist/integrations/react/doctor.js +65 -0
- package/dist/integrations/react/doctor.js.map +1 -0
- package/dist/integrations/react/files.d.ts +4 -0
- package/dist/integrations/react/files.d.ts.map +1 -0
- package/dist/integrations/react/files.js +24 -0
- package/dist/integrations/react/files.js.map +1 -0
- package/dist/integrations/react/index.d.ts +17 -0
- package/dist/integrations/react/index.d.ts.map +1 -0
- package/dist/integrations/react/index.js +62 -0
- package/dist/integrations/react/index.js.map +1 -0
- package/dist/integrations/react/manifest.d.ts +3 -0
- package/dist/integrations/react/manifest.d.ts.map +1 -0
- package/dist/integrations/react/manifest.js +31 -0
- package/dist/integrations/react/manifest.js.map +1 -0
- package/dist/integrations/react/patch.d.ts +4 -0
- package/dist/integrations/react/patch.d.ts.map +1 -0
- package/dist/integrations/react/patch.js +39 -0
- package/dist/integrations/react/patch.js.map +1 -0
- package/dist/integrations/react/uninstall.d.ts +4 -0
- package/dist/integrations/react/uninstall.d.ts.map +1 -0
- package/dist/integrations/react/uninstall.js +21 -0
- package/dist/integrations/react/uninstall.js.map +1 -0
- package/dist/integrations/react-native.d.ts +10 -0
- package/dist/integrations/react-native.d.ts.map +1 -0
- package/dist/integrations/react-native.js +57 -0
- package/dist/integrations/react-native.js.map +1 -0
- package/dist/integrations/ruby.d.ts +2 -0
- package/dist/integrations/ruby.d.ts.map +1 -0
- package/dist/integrations/ruby.js +9 -0
- package/dist/integrations/ruby.js.map +1 -0
- package/dist/lifecycle/hooks.d.ts +42 -0
- package/dist/lifecycle/hooks.d.ts.map +1 -0
- package/dist/lifecycle/hooks.js +43 -0
- package/dist/lifecycle/hooks.js.map +1 -0
- package/dist/migrations/builtin/dsn-to-api-key.d.ts +3 -0
- package/dist/migrations/builtin/dsn-to-api-key.d.ts.map +1 -0
- package/dist/migrations/builtin/dsn-to-api-key.js +59 -0
- package/dist/migrations/builtin/dsn-to-api-key.js.map +1 -0
- package/dist/migrations/engine.d.ts +52 -0
- package/dist/migrations/engine.d.ts.map +1 -0
- package/dist/migrations/engine.js +46 -0
- package/dist/migrations/engine.js.map +1 -0
- package/dist/migrations/index.d.ts +3 -0
- package/dist/migrations/index.d.ts.map +1 -0
- package/dist/migrations/index.js +11 -0
- package/dist/migrations/index.js.map +1 -0
- package/dist/output/human.d.ts +20 -0
- package/dist/output/human.d.ts.map +1 -0
- package/dist/output/human.js +77 -0
- package/dist/output/human.js.map +1 -0
- package/dist/output/index.d.ts +6 -0
- package/dist/output/index.d.ts.map +1 -0
- package/dist/output/index.js +8 -0
- package/dist/output/index.js.map +1 -0
- package/dist/output/json.d.ts +20 -0
- package/dist/output/json.d.ts.map +1 -0
- package/dist/output/json.js +60 -0
- package/dist/output/json.js.map +1 -0
- package/dist/output/types.d.ts +36 -0
- package/dist/output/types.d.ts.map +1 -0
- package/dist/output/types.js +2 -0
- package/dist/output/types.js.map +1 -0
- package/dist/patchers/env-file.d.ts +21 -0
- package/dist/patchers/env-file.d.ts.map +1 -0
- package/dist/patchers/env-file.js +77 -0
- package/dist/patchers/env-file.js.map +1 -0
- package/dist/patchers/js-ast.d.ts +29 -0
- package/dist/patchers/js-ast.d.ts.map +1 -0
- package/dist/patchers/js-ast.js +71 -0
- package/dist/patchers/js-ast.js.map +1 -0
- package/dist/patchers/json-file.d.ts +19 -0
- package/dist/patchers/json-file.d.ts.map +1 -0
- package/dist/patchers/json-file.js +41 -0
- package/dist/patchers/json-file.js.map +1 -0
- package/dist/patchers/markers.d.ts +28 -0
- package/dist/patchers/markers.d.ts.map +1 -0
- package/dist/patchers/markers.js +49 -0
- package/dist/patchers/markers.js.map +1 -0
- package/dist/patchers/source-block.d.ts +24 -0
- package/dist/patchers/source-block.d.ts.map +1 -0
- package/dist/patchers/source-block.js +40 -0
- package/dist/patchers/source-block.js.map +1 -0
- package/dist/registry/index.d.ts +5 -0
- package/dist/registry/index.d.ts.map +1 -0
- package/dist/registry/index.js +42 -0
- package/dist/registry/index.js.map +1 -0
- package/dist/registry/manifest.d.ts +78 -0
- package/dist/registry/manifest.d.ts.map +1 -0
- package/dist/registry/manifest.js +2 -0
- package/dist/registry/manifest.js.map +1 -0
- package/dist/registry/registry.d.ts +14 -0
- package/dist/registry/registry.d.ts.map +1 -0
- package/dist/registry/registry.js +29 -0
- package/dist/registry/registry.js.map +1 -0
- package/dist/registry/types.d.ts +78 -0
- package/dist/registry/types.d.ts.map +1 -0
- package/dist/registry/types.js +2 -0
- package/dist/registry/types.js.map +1 -0
- package/dist/snapshot/restore.d.ts +41 -0
- package/dist/snapshot/restore.d.ts.map +1 -0
- package/dist/snapshot/restore.js +110 -0
- package/dist/snapshot/restore.js.map +1 -0
- package/dist/snapshot/store.d.ts +105 -0
- package/dist/snapshot/store.d.ts.map +1 -0
- package/dist/snapshot/store.js +162 -0
- package/dist/snapshot/store.js.map +1 -0
- package/dist/sourcemaps/index.d.ts +3 -0
- package/dist/sourcemaps/index.d.ts.map +1 -0
- package/dist/sourcemaps/index.js +17 -0
- package/dist/sourcemaps/index.js.map +1 -0
- package/dist/sourcemaps/metro.d.ts +11 -0
- package/dist/sourcemaps/metro.d.ts.map +1 -0
- package/dist/sourcemaps/metro.js +31 -0
- package/dist/sourcemaps/metro.js.map +1 -0
- package/dist/sourcemaps/next.d.ts +3 -0
- package/dist/sourcemaps/next.d.ts.map +1 -0
- package/dist/sourcemaps/next.js +46 -0
- package/dist/sourcemaps/next.js.map +1 -0
- package/dist/sourcemaps/provider.d.ts +51 -0
- package/dist/sourcemaps/provider.d.ts.map +1 -0
- package/dist/sourcemaps/provider.js +29 -0
- package/dist/sourcemaps/provider.js.map +1 -0
- package/dist/sourcemaps/vite.d.ts +3 -0
- package/dist/sourcemaps/vite.d.ts.map +1 -0
- package/dist/sourcemaps/vite.js +60 -0
- package/dist/sourcemaps/vite.js.map +1 -0
- package/dist/sourcemaps/webpack.d.ts +8 -0
- package/dist/sourcemaps/webpack.d.ts.map +1 -0
- package/dist/sourcemaps/webpack.js +52 -0
- package/dist/sourcemaps/webpack.js.map +1 -0
- package/dist/telemetry/cli-wrap.d.ts +22 -0
- package/dist/telemetry/cli-wrap.d.ts.map +1 -0
- package/dist/telemetry/cli-wrap.js +53 -0
- package/dist/telemetry/cli-wrap.js.map +1 -0
- package/dist/telemetry/http-provider.d.ts +28 -0
- package/dist/telemetry/http-provider.d.ts.map +1 -0
- package/dist/telemetry/http-provider.js +24 -0
- package/dist/telemetry/http-provider.js.map +1 -0
- package/dist/telemetry/index.d.ts +7 -0
- package/dist/telemetry/index.d.ts.map +1 -0
- package/dist/telemetry/index.js +6 -0
- package/dist/telemetry/index.js.map +1 -0
- package/dist/telemetry/install-id.d.ts +3 -0
- package/dist/telemetry/install-id.d.ts.map +1 -0
- package/dist/telemetry/install-id.js +46 -0
- package/dist/telemetry/install-id.js.map +1 -0
- package/dist/telemetry/payload.d.ts +82 -0
- package/dist/telemetry/payload.d.ts.map +1 -0
- package/dist/telemetry/payload.js +82 -0
- package/dist/telemetry/payload.js.map +1 -0
- package/dist/telemetry/provider.d.ts +32 -0
- package/dist/telemetry/provider.d.ts.map +1 -0
- package/dist/telemetry/provider.js +30 -0
- package/dist/telemetry/provider.js.map +1 -0
- package/dist/telemetry/runtime.d.ts +29 -0
- package/dist/telemetry/runtime.d.ts.map +1 -0
- package/dist/telemetry/runtime.js +44 -0
- package/dist/telemetry/runtime.js.map +1 -0
- package/dist/transaction/tx.d.ts +58 -0
- package/dist/transaction/tx.d.ts.map +1 -0
- package/dist/transaction/tx.js +170 -0
- package/dist/transaction/tx.js.map +1 -0
- package/dist/util/error-codes.d.ts +29 -0
- package/dist/util/error-codes.d.ts.map +1 -0
- package/dist/util/error-codes.js +192 -0
- package/dist/util/error-codes.js.map +1 -0
- package/dist/util/errors.d.ts +83 -0
- package/dist/util/errors.d.ts.map +1 -0
- package/dist/util/errors.js +110 -0
- package/dist/util/errors.js.map +1 -0
- package/dist/util/log.d.ts +11 -0
- package/dist/util/log.d.ts.map +1 -0
- package/dist/util/log.js +18 -0
- package/dist/util/log.js.map +1 -0
- package/dist/util/paths.d.ts +3 -0
- package/dist/util/paths.d.ts.map +1 -0
- package/dist/util/paths.js +31 -0
- package/dist/util/paths.js.map +1 -0
- package/dist/util/version.d.ts +15 -0
- package/dist/util/version.d.ts.map +1 -0
- package/dist/util/version.js +40 -0
- package/dist/util/version.js.map +1 -0
- package/dist/util/wizard-version.d.ts +6 -0
- package/dist/util/wizard-version.d.ts.map +1 -0
- package/dist/util/wizard-version.js +6 -0
- package/dist/util/wizard-version.js.map +1 -0
- package/docs/architecture/README.md +58 -0
- package/docs/architecture/dry-run.md +34 -0
- package/docs/architecture/integration-lifecycle.md +77 -0
- package/docs/architecture/patch-pipeline.md +58 -0
- package/docs/architecture/registry.md +52 -0
- package/docs/architecture/rollback.md +47 -0
- package/docs/architecture/sourcemaps.md +53 -0
- package/docs/architecture/stability-levels.md +35 -0
- package/docs/architecture/transaction.md +51 -0
- package/docs/architecture/v02-bare-react-native-spec.md +92 -0
- package/docs/architecture/v02-java-host-fix-spec.md +125 -0
- package/docs/architecture/v02-sourcemaps-e2e-spec.md +157 -0
- package/package.json +98 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `@allstak/wizard` will be documented here. The format
|
|
4
|
+
follows [Keep a Changelog](https://keepachangelog.com/) and this project
|
|
5
|
+
adheres to [Semantic Versioning](https://semver.org/).
|
|
6
|
+
|
|
7
|
+
## [Unreleased] — 0.1.3
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
- Privacy-safe telemetry (`src/telemetry/*`) — disabled by default until an
|
|
11
|
+
HTTP provider is wired in. `--no-telemetry` / `--telemetry-debug` flags +
|
|
12
|
+
`ALLSTAK_WIZARD_TELEMETRY=0` env opt-out. Provider abstraction allows
|
|
13
|
+
swapping between `noopTelemetry` and `httpTelemetry({ endpoint })`. Test
|
|
14
|
+
asserts the payload contains EXACTLY the documented fields.
|
|
15
|
+
- Centralised error catalog (`src/util/error-codes.ts`) with 22 canonical
|
|
16
|
+
codes. Every `WizardError` carries a stable `code` (public contract) and
|
|
17
|
+
optional `subcode` (internal grep). Coupled refactor of every throw site
|
|
18
|
+
to align with the catalog. JSON output now includes the structured error
|
|
19
|
+
via `WizardError.toPublicJSON()`.
|
|
20
|
+
- `allstak.config.*` schema versioning: `schemaVersion` field +
|
|
21
|
+
`runConfigMigrations()` runner + `allstak config validate` /
|
|
22
|
+
`allstak config migrate` commands. Migration list is empty in v0.1.3
|
|
23
|
+
(current schema is v1) but the runner is plumbed and tested.
|
|
24
|
+
- 11 public-beta docs under `docs/beta/`: quickstart, react, next, node,
|
|
25
|
+
doctor, restore, config, ci, privacy, known-limitations,
|
|
26
|
+
troubleshooting.
|
|
27
|
+
- Canonical error catalog doc at `docs/errors.md`.
|
|
28
|
+
|
|
29
|
+
### Changed
|
|
30
|
+
- CLI top-level error handler routes through `toWizardError()` and emits a
|
|
31
|
+
structured JSON envelope under `--json` even when a command throws before
|
|
32
|
+
the reporter finalises.
|
|
33
|
+
- `CredentialError` now extends `WizardError` (canonical code
|
|
34
|
+
`E_PERMISSION_DENIED`); old `CredentialError.code` becomes `subcode`.
|
|
35
|
+
- `TransactionAbortedError.cause` renamed to `originalCause` to avoid
|
|
36
|
+
shadowing `Error.cause`.
|
|
37
|
+
|
|
38
|
+
### Internal
|
|
39
|
+
- Telemetry runtime threads through every command via `withTelemetry()`
|
|
40
|
+
wrapper in `cli.ts`. Provider failures NEVER abort the wizard.
|
|
41
|
+
- Anonymous install id stored at `~/.config/allstak/install-id`; rotates
|
|
42
|
+
on file deletion.
|
|
43
|
+
|
|
44
|
+
## [0.1.2] — 2026-05-07
|
|
45
|
+
|
|
46
|
+
### Added
|
|
47
|
+
- Real `allstak login` / `logout` / `whoami` against the AllStak email-OTP backend
|
|
48
|
+
(`/api/v1/auth/request-otp` → `/api/v1/auth/verify-otp`), with TOTP second-factor
|
|
49
|
+
support and JWT refresh-token rotation via `/api/v1/auth/refresh`.
|
|
50
|
+
- Cross-platform credential storage: macOS Keychain (via `security`), Linux
|
|
51
|
+
Secret Service (via `secret-tool`), and an AES-256-GCM encrypted-file fallback
|
|
52
|
+
with machine-bound key derivation. `ALLSTAK_CREDENTIAL_STORE` env var to force
|
|
53
|
+
a specific store for testing.
|
|
54
|
+
- `allstak.config.{ts,mts,mjs,js,cjs,json}` discovery via `defineConfig()` with
|
|
55
|
+
full schema validation and unknown-key suggestion. Precedence:
|
|
56
|
+
CLI > env > config > defaults. Self-hosted endpoints (`apiHost`/`ingestHost`/
|
|
57
|
+
`dashboardHost`) configurable from the file.
|
|
58
|
+
- `allstak orgs list` and `allstak projects list/create` against
|
|
59
|
+
`/api/v1/organizations` and `/api/v1/projects`. `--with-api-key` mints a
|
|
60
|
+
project key after creation.
|
|
61
|
+
- `allstak restore` (`list` / `show` / `apply` / `diff`) operating on
|
|
62
|
+
`.allstak-wizard/backups/`. Per-file restore, dry-run, transactional rollback.
|
|
63
|
+
- `allstak doctor` rewritten with deterministic stages: `auth` → `reachability`
|
|
64
|
+
→ `config` → `integration` → `event-ingest` → `release-linkage` → `source-maps`.
|
|
65
|
+
`--live-probe` sends a real test event via `POST /ingest/v1/errors` and polls
|
|
66
|
+
`GET /api/v1/errors` for ingestion. Each stage returns
|
|
67
|
+
`pass`/`warn`/`fail`/`skip` with an exact actionable fix.
|
|
68
|
+
- semantic-release config + GitHub Actions matrix CI for React+Vite, Next
|
|
69
|
+
(app + pages router), and Node fixtures across Node 18/20/22.
|
|
70
|
+
|
|
71
|
+
### Changed
|
|
72
|
+
- `buildContext` is now async and returns `{ ctx, resolvedConfig, configSource }`
|
|
73
|
+
so commands can surface the active config source in `--json` output.
|
|
74
|
+
|
|
75
|
+
### Internal
|
|
76
|
+
- `src/api/` typed HTTP client with auth modes (`bearer` / `apiKey` / `none`),
|
|
77
|
+
request timeouts, and backend-error code preservation.
|
|
78
|
+
- `src/credentials/` multi-backend store with platform auto-detection.
|
|
79
|
+
- `src/snapshot/restore.ts` exposes `restoreSnapshot` / `restoreFiles` /
|
|
80
|
+
`diffSnapshot` for programmatic recovery.
|
|
81
|
+
|
|
82
|
+
## [0.1.1] — 2026-05-07
|
|
83
|
+
|
|
84
|
+
Architecture hardening release. See report
|
|
85
|
+
`docs/reports/2026-05-07-allstak-wizard-v0.1.1-architecture-hardening.md`.
|
|
86
|
+
|
|
87
|
+
## [0.1.0] — 2026-05-07
|
|
88
|
+
|
|
89
|
+
Initial scaffold. See report
|
|
90
|
+
`docs/reports/2026-05-07-allstak-wizard-v0.1-implementation.md`.
|
package/README.md
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# @allstak/wizard
|
|
2
|
+
|
|
3
|
+
> v0.1 — Unified installation and configuration wizard for AllStak SDKs.
|
|
4
|
+
|
|
5
|
+
A Sentry-Wizard-style CLI that installs and configures AllStak SDKs in your project with one command. Designed to be **honest by default**: only integrations validated end-to-end against real fixture projects ship with the `VALIDATED` tag; everything else is `SCAFFOLD` and refuses to apply patches without `--experimental`.
|
|
6
|
+
|
|
7
|
+
## Status
|
|
8
|
+
|
|
9
|
+
| Integration | Tag | Notes |
|
|
10
|
+
|---------------|-------------|-------|
|
|
11
|
+
| `react` | VALIDATED | Vite + plain React, AST-tested |
|
|
12
|
+
| `next` | VALIDATED | Next 13+ app & pages router |
|
|
13
|
+
| `js` | VALIDATED | Vanilla Node entry-point patching |
|
|
14
|
+
| `expo` | SCAFFOLD | Config-plugin path scaffolded; native build verification deferred to v0.2 |
|
|
15
|
+
| `react-native` | UNSUPPORTED | Bare RN intentionally refused — Podfile/Gradle patching not validated |
|
|
16
|
+
| `nestjs` / `fastify` / `otel` / `python` / `go` / `java` / `php` / `ruby` / `dotnet` / `flutter` | SCAFFOLD | Env-var writing only; framework wiring deferred to v0.2 |
|
|
17
|
+
|
|
18
|
+
Run `allstak-wizard list` to see this matrix at runtime.
|
|
19
|
+
|
|
20
|
+
## Install
|
|
21
|
+
|
|
22
|
+
In v0.1 the package is not published. To run from source:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
cd /path/to/sdks/allstak-wizard
|
|
26
|
+
npm install
|
|
27
|
+
npx tsx src/cli.ts --help
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Usage
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
# Auto-detect framework, interactive
|
|
34
|
+
allstak-wizard
|
|
35
|
+
|
|
36
|
+
# Explicit, non-interactive
|
|
37
|
+
allstak-wizard -i react --api-key $ALLSTAK_API_KEY -y
|
|
38
|
+
|
|
39
|
+
# Self-hosted
|
|
40
|
+
allstak-wizard -i next --host https://api.acme.allstak.com --api-key $KEY -y
|
|
41
|
+
|
|
42
|
+
# Dry run (prints diff, writes nothing)
|
|
43
|
+
allstak-wizard -i react --dry-run -y
|
|
44
|
+
|
|
45
|
+
# Other commands
|
|
46
|
+
allstak-wizard list
|
|
47
|
+
allstak-wizard doctor [-i react]
|
|
48
|
+
allstak-wizard repair -i react
|
|
49
|
+
allstak-wizard uninstall -i react -y
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Authentication (v0.1)
|
|
53
|
+
|
|
54
|
+
Browser/device-flow login is **not** implemented in v0.1. Provide a key via `--api-key` or `ALLSTAK_API_KEY`. `allstak-wizard login` exits with a clear hint.
|
|
55
|
+
|
|
56
|
+
## Architecture
|
|
57
|
+
|
|
58
|
+
- **Registry** — every integration is an `Integration` object with `detect`, `plan`, `install`, `patch`, `validate`, `uninstall`, `repair`, `doctor` methods. New integrations register themselves; the CLI is integration-agnostic.
|
|
59
|
+
- **Transaction** — every file mutation goes through a `Transaction` that snapshots before writing, validates syntax after writing, and rolls back the entire batch on any failure.
|
|
60
|
+
- **Markers** — every injected region is wrapped with `>>> allstak-wizard:v1` markers. Re-runs replace the existing block (idempotent). `uninstall` removes the block cleanly.
|
|
61
|
+
- **AST patching** — JS/TS files use `magicast` (recast under the hood) to add imports without disturbing user code; non-AST changes (provider wrap hints, Vite plugin hints) live in marker blocks.
|
|
62
|
+
- **Dry-run** — every command supports `--dry-run`; the transaction layer captures the diff but skips disk writes.
|
|
63
|
+
|
|
64
|
+
## Self-hosted support
|
|
65
|
+
|
|
66
|
+
The wizard never assumes `api.allstak.sa`; pass `--host`, `--ingest-host`, and `--dashboard-host` to point at any AllStak deployment. Note: the Java SDK currently hardcodes its host — that's a known SDK-side bug, not a wizard bug. See the v0.1 implementation report for details.
|
|
67
|
+
|
|
68
|
+
## Testing
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
npm run test # 46 tests across markers, transaction, patchers, detect, integrations
|
|
72
|
+
npm run type-check
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Tests use temp-dir fixtures (no network, no SDK install required) and validate idempotency, rollback, dry-run, and uninstall round-trips for all VALIDATED integrations.
|
|
76
|
+
|
|
77
|
+
## v0.2 roadmap
|
|
78
|
+
|
|
79
|
+
See `docs/reports/allstak-unified-sdk-wizard-v0.1-implementation.md` (in the platform monorepo) for the full plan.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { TokenPair, MeResponse } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Auth API client — wraps `/api/v1/auth/*` endpoints from the AllStak backend.
|
|
4
|
+
*
|
|
5
|
+
* Backend reference (verified 2026-05-07):
|
|
6
|
+
* POST /api/v1/auth/request-otp → 200 { status: "sent" } (enumeration-safe)
|
|
7
|
+
* POST /api/v1/auth/verify-otp → 200 TokenPair (or { requires2fa: true } partial)
|
|
8
|
+
* POST /api/v1/auth/verify-2fa-login → 200 TokenPair (full)
|
|
9
|
+
* POST /api/v1/auth/refresh → 200 TokenPair (rotated)
|
|
10
|
+
* POST /api/v1/auth/logout → 204 (revokes current session)
|
|
11
|
+
* GET /api/v1/auth/me → 200 MeResponse
|
|
12
|
+
* GET /api/v1/auth/check-2fa → 200 { required: boolean }
|
|
13
|
+
*/
|
|
14
|
+
export declare function requestOtp(host: string, email: string): Promise<{
|
|
15
|
+
status: string;
|
|
16
|
+
}>;
|
|
17
|
+
export declare function verifyOtp(host: string, email: string, code: string): Promise<TokenPair>;
|
|
18
|
+
export declare function verify2faLogin(host: string, partialToken: string, totpCode: string): Promise<TokenPair>;
|
|
19
|
+
export declare function refreshTokens(host: string, refreshToken: string): Promise<TokenPair>;
|
|
20
|
+
export declare function logout(host: string, accessToken: string): Promise<void>;
|
|
21
|
+
export declare function whoami(host: string, accessToken: string): Promise<MeResponse>;
|
|
22
|
+
//# sourceMappingURL=auth-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-client.d.ts","sourceRoot":"","sources":["../../src/api/auth-client.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExD;;;;;;;;;;;GAWG;AAEH,wBAAsB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAQzF;AAED,wBAAsB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAQ7F;AAED,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAQ7G;AAED,wBAAsB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAQ1F;AAED,wBAAsB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAM7E;AAED,wBAAsB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAOnF"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { apiRequest } from './http.js';
|
|
2
|
+
/**
|
|
3
|
+
* Auth API client — wraps `/api/v1/auth/*` endpoints from the AllStak backend.
|
|
4
|
+
*
|
|
5
|
+
* Backend reference (verified 2026-05-07):
|
|
6
|
+
* POST /api/v1/auth/request-otp → 200 { status: "sent" } (enumeration-safe)
|
|
7
|
+
* POST /api/v1/auth/verify-otp → 200 TokenPair (or { requires2fa: true } partial)
|
|
8
|
+
* POST /api/v1/auth/verify-2fa-login → 200 TokenPair (full)
|
|
9
|
+
* POST /api/v1/auth/refresh → 200 TokenPair (rotated)
|
|
10
|
+
* POST /api/v1/auth/logout → 204 (revokes current session)
|
|
11
|
+
* GET /api/v1/auth/me → 200 MeResponse
|
|
12
|
+
* GET /api/v1/auth/check-2fa → 200 { required: boolean }
|
|
13
|
+
*/
|
|
14
|
+
export async function requestOtp(host, email) {
|
|
15
|
+
const res = await apiRequest(host, {
|
|
16
|
+
method: 'POST',
|
|
17
|
+
path: '/api/v1/auth/request-otp',
|
|
18
|
+
body: { email },
|
|
19
|
+
auth: { kind: 'none' },
|
|
20
|
+
});
|
|
21
|
+
return res.data;
|
|
22
|
+
}
|
|
23
|
+
export async function verifyOtp(host, email, code) {
|
|
24
|
+
const res = await apiRequest(host, {
|
|
25
|
+
method: 'POST',
|
|
26
|
+
path: '/api/v1/auth/verify-otp',
|
|
27
|
+
body: { email, code },
|
|
28
|
+
auth: { kind: 'none' },
|
|
29
|
+
});
|
|
30
|
+
return res.data;
|
|
31
|
+
}
|
|
32
|
+
export async function verify2faLogin(host, partialToken, totpCode) {
|
|
33
|
+
const res = await apiRequest(host, {
|
|
34
|
+
method: 'POST',
|
|
35
|
+
path: '/api/v1/auth/verify-2fa-login',
|
|
36
|
+
body: { code: totpCode },
|
|
37
|
+
auth: { kind: 'bearer', token: partialToken },
|
|
38
|
+
});
|
|
39
|
+
return res.data;
|
|
40
|
+
}
|
|
41
|
+
export async function refreshTokens(host, refreshToken) {
|
|
42
|
+
const res = await apiRequest(host, {
|
|
43
|
+
method: 'POST',
|
|
44
|
+
path: '/api/v1/auth/refresh',
|
|
45
|
+
body: { refreshToken },
|
|
46
|
+
auth: { kind: 'none' }, // refresh endpoint accepts the token in body
|
|
47
|
+
});
|
|
48
|
+
return res.data;
|
|
49
|
+
}
|
|
50
|
+
export async function logout(host, accessToken) {
|
|
51
|
+
await apiRequest(host, {
|
|
52
|
+
method: 'POST',
|
|
53
|
+
path: '/api/v1/auth/logout',
|
|
54
|
+
auth: { kind: 'bearer', token: accessToken },
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
export async function whoami(host, accessToken) {
|
|
58
|
+
const res = await apiRequest(host, {
|
|
59
|
+
method: 'GET',
|
|
60
|
+
path: '/api/v1/auth/me',
|
|
61
|
+
auth: { kind: 'bearer', token: accessToken },
|
|
62
|
+
});
|
|
63
|
+
return res.data;
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=auth-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-client.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UAAU,CAAY,IAAI,EAAE;QAC5C,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,sBAAsB;QAC5B,IAAI,EAAE,EAAE,YAAY,EAAE;QACtB,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,6CAA6C;KACtE,CAAC,CAAC;IACH,OAAO,GAAG,CAAC,IAAI,CAAC;AAClB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,IAAY,EAAE,WAAmB;IAC5D,MAAM,UAAU,CAAU,IAAI,EAAE;QAC9B,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,qBAAqB;QAC3B,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,WAAW,EAAE;KAC7C,CAAC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,IAAY,EAAE,WAAmB;IAC5D,MAAM,GAAG,GAAG,MAAM,UAAU,CAAa,IAAI,EAAE;QAC7C,MAAM,EAAE,KAAK;QACb,IAAI,EAAE,iBAAiB;QACvB,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,WAAW,EAAE;KAC7C,CAAC,CAAC;IACH,OAAO,GAAG,CAAC,IAAI,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { Credentials } from '../credentials/types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Auth resolution helpers.
|
|
4
|
+
*
|
|
5
|
+
* Two modes the wizard supports:
|
|
6
|
+
*
|
|
7
|
+
* 1. CI / one-shot: caller provides a project API key via --api-key or
|
|
8
|
+
* `ALLSTAK_API_KEY`. Used for `allstak-wizard -i react --api-key ...`.
|
|
9
|
+
*
|
|
10
|
+
* 2. Interactive: user has run `allstak login` first; the wizard reads the
|
|
11
|
+
* JWT from the credential store and auto-refreshes it when expired.
|
|
12
|
+
* Used for `allstak orgs list`, `allstak doctor`, etc.
|
|
13
|
+
*
|
|
14
|
+
* The two modes are NOT interchangeable: `--api-key` is a project-scoped
|
|
15
|
+
* ingestion credential and cannot list orgs; the JWT is a user credential and
|
|
16
|
+
* cannot send events. The control-plane vs. data-plane split mirrors what the
|
|
17
|
+
* backend exposes (`/api/v1/*` vs `/ingest/v1/*`).
|
|
18
|
+
*/
|
|
19
|
+
export interface AuthResolveOptions {
|
|
20
|
+
apiKey?: string;
|
|
21
|
+
envFallback?: boolean;
|
|
22
|
+
}
|
|
23
|
+
export declare function resolveApiKey(opts: AuthResolveOptions): string;
|
|
24
|
+
/**
|
|
25
|
+
* Read user credentials from the platform credential store. Auto-refreshes
|
|
26
|
+
* the access token if it expires within the next 60s (the access TTL is 15
|
|
27
|
+
* minutes; we refresh proactively).
|
|
28
|
+
*
|
|
29
|
+
* Returns null when the user has not run `allstak login`. Throws when
|
|
30
|
+
* credentials exist but cannot be refreshed (caller should ask the user to
|
|
31
|
+
* re-authenticate).
|
|
32
|
+
*/
|
|
33
|
+
export declare function loadUserCredentials(host: string): Promise<Credentials | null>;
|
|
34
|
+
/**
|
|
35
|
+
* Convenience wrapper that throws when the user is not logged in. Used by
|
|
36
|
+
* commands that absolutely require a user JWT (orgs/projects).
|
|
37
|
+
*/
|
|
38
|
+
export declare function requireUserCredentials(host: string): Promise<Credentials>;
|
|
39
|
+
//# sourceMappingURL=auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/api/auth.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE3D;;;;;;;;;;;;;;;;GAgBG;AAEH,MAAM,WAAW,kBAAkB;IACjC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,kBAAkB,GAAG,MAAM,CAgB9D;AAED;;;;;;;;GAQG;AACH,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,CA6BnF;AAED;;;GAGG;AACH,wBAAsB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAc/E"}
|
package/dist/api/auth.js
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { WizardError } from '../util/errors.js';
|
|
2
|
+
import { getCredentialStore } from '../credentials/index.js';
|
|
3
|
+
import { refreshTokens } from './auth-client.js';
|
|
4
|
+
export function resolveApiKey(opts) {
|
|
5
|
+
if (opts.apiKey && opts.apiKey.trim().length > 0)
|
|
6
|
+
return opts.apiKey.trim();
|
|
7
|
+
if (opts.envFallback !== false) {
|
|
8
|
+
const fromEnv = process.env.ALLSTAK_API_KEY;
|
|
9
|
+
if (fromEnv && fromEnv.trim().length > 0)
|
|
10
|
+
return fromEnv.trim();
|
|
11
|
+
}
|
|
12
|
+
throw new WizardError('E_AUTH_REQUIRED', 'No AllStak project API key provided.', {
|
|
13
|
+
subcode: 'E_MISSING_KEY',
|
|
14
|
+
hint: 'Pass --api-key or set ALLSTAK_API_KEY in your environment. ' +
|
|
15
|
+
'Or run `allstak login` to authenticate as a user and `allstak projects create` to mint a key.',
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Read user credentials from the platform credential store. Auto-refreshes
|
|
20
|
+
* the access token if it expires within the next 60s (the access TTL is 15
|
|
21
|
+
* minutes; we refresh proactively).
|
|
22
|
+
*
|
|
23
|
+
* Returns null when the user has not run `allstak login`. Throws when
|
|
24
|
+
* credentials exist but cannot be refreshed (caller should ask the user to
|
|
25
|
+
* re-authenticate).
|
|
26
|
+
*/
|
|
27
|
+
export async function loadUserCredentials(host) {
|
|
28
|
+
const store = await getCredentialStore();
|
|
29
|
+
const creds = await store.load(host);
|
|
30
|
+
if (!creds)
|
|
31
|
+
return null;
|
|
32
|
+
const now = Date.now();
|
|
33
|
+
const remainingMs = creds.accessExpiresAt - now;
|
|
34
|
+
if (remainingMs > 60_000)
|
|
35
|
+
return creds;
|
|
36
|
+
// Attempt refresh. If it fails (e.g. refresh token revoked), surface a clean
|
|
37
|
+
// error so the CLI can prompt for re-login.
|
|
38
|
+
try {
|
|
39
|
+
const tp = await refreshTokens(host, creds.refreshToken);
|
|
40
|
+
const refreshed = {
|
|
41
|
+
...creds,
|
|
42
|
+
accessToken: tp.accessToken,
|
|
43
|
+
refreshToken: tp.refreshToken,
|
|
44
|
+
accessExpiresAt: now + tp.expiresInSeconds * 1000,
|
|
45
|
+
storedAt: now,
|
|
46
|
+
};
|
|
47
|
+
await store.save(refreshed);
|
|
48
|
+
return refreshed;
|
|
49
|
+
}
|
|
50
|
+
catch (err) {
|
|
51
|
+
throw new WizardError('E_AUTH_EXPIRED', `Stored credentials for ${host} are no longer valid (${err instanceof Error ? err.message : String(err)}).`, { subcode: 'E_AUTH_REFRESH_FAILED', context: { host }, cause: err });
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Convenience wrapper that throws when the user is not logged in. Used by
|
|
56
|
+
* commands that absolutely require a user JWT (orgs/projects).
|
|
57
|
+
*/
|
|
58
|
+
export async function requireUserCredentials(host) {
|
|
59
|
+
const creds = await loadUserCredentials(host);
|
|
60
|
+
if (!creds) {
|
|
61
|
+
throw new WizardError('E_AUTH_REQUIRED', `Not logged in to ${host}.`, {
|
|
62
|
+
subcode: 'E_NOT_LOGGED_IN',
|
|
63
|
+
hint: 'Run `allstak login` first, or pass --api-key for ingestion-only commands.',
|
|
64
|
+
context: { host },
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
return creds;
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/api/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE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C,YAAY,CAAC,CAAC;QACzD,MAAM,SAAS,GAAgB;YAC7B,GAAG,KAAK;YACR,WAAW,EAAE,EAAE,CAAC,WAAW;YAC3B,YAAY,EAAE,EAAE,CAAC,YAAY;YAC7B,eAAe,EAAE,GAAG,GAAG,EAAE,CAAC,gBAAgB,GAAG,IAAI;YACjD,QAAQ,EAAE,GAAG;SACd,CAAC;QACF,MAAM,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC5B,OAAO,SAAS,CAAC;IACnB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,IAAI,WAAW,CACnB,gBAAgB,EAChB,0BAA0B,IAAI,yBAAyB,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,EAC3G,EAAE,OAAO,EAAE,uBAAuB,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,CACpE,CAAC;IACJ,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAAC,IAAY;IACvD,MAAM,KAAK,GAAG,MAAM,mBAAmB,CAAC,IAAI,CAAC,CAAC;IAC9C,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,WAAW,CACnB,iBAAiB,EACjB,oBAAoB,IAAI,GAAG,EAC3B;YACE,OAAO,EAAE,iBAAiB;YAC1B,IAAI,EAAE,2EAA2E;YACjF,OAAO,EAAE,EAAE,IAAI,EAAE;SAClB,CACF,CAAC;IACJ,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal HTTP client used by `doctor` for connectivity probes and (eventually)
|
|
3
|
+
* by `login` once a real device-flow endpoint exists.
|
|
4
|
+
*
|
|
5
|
+
* Intentionally tiny: no retry, no auth wiring beyond a Bearer header. Doctor
|
|
6
|
+
* uses it to probe `${ingestHost}/health` and `${dashboardHost}/api/health`;
|
|
7
|
+
* any non-2xx is reported as a degraded check, not a hard failure.
|
|
8
|
+
*/
|
|
9
|
+
export interface ProbeResult {
|
|
10
|
+
ok: boolean;
|
|
11
|
+
status: number | null;
|
|
12
|
+
detail: string;
|
|
13
|
+
}
|
|
14
|
+
export declare function probe(url: string, headers?: Record<string, string>): Promise<ProbeResult>;
|
|
15
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/api/client.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,OAAO,CAAC;IACZ,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,wBAAsB,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAgBnG"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export async function probe(url, headers = {}) {
|
|
2
|
+
try {
|
|
3
|
+
const res = await fetch(url, {
|
|
4
|
+
method: 'GET',
|
|
5
|
+
headers,
|
|
6
|
+
signal: AbortSignal.timeout(5000),
|
|
7
|
+
});
|
|
8
|
+
return {
|
|
9
|
+
ok: res.ok,
|
|
10
|
+
status: res.status,
|
|
11
|
+
detail: res.ok ? `HTTP ${res.status}` : `HTTP ${res.status} ${res.statusText}`,
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
catch (err) {
|
|
15
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
16
|
+
return { ok: false, status: null, detail: msg };
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/api/client.ts"],"names":[],"mappings":"AAcA,MAAM,CAAC,KAAK,UAAU,KAAK,CAAC,GAAW,EAAE,UAAkC,EAAE;IAC3E,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE;YAC3B,MAAM,EAAE,KAAK;YACb,OAAO;YACP,MAAM,EAAE,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC;SAClC,CAAC,CAAC;QACH,OAAO;YACL,EAAE,EAAE,GAAG,CAAC,EAAE;YACV,MAAM,EAAE,GAAG,CAAC,MAAM;YAClB,MAAM,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,QAAQ,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC,UAAU,EAAE;SAC/E,CAAC;IACJ,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,GAAG,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAC7D,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;IAClD,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal typed HTTP client for the AllStak control-plane API.
|
|
3
|
+
*
|
|
4
|
+
* Design rules:
|
|
5
|
+
* - Pure function-based (no class state), one fetch per call.
|
|
6
|
+
* - Auth modes are explicit per request: { kind: 'bearer'|'apiKey'|'none' }.
|
|
7
|
+
* - Errors normalised into WizardError with backend `error.code` preserved.
|
|
8
|
+
* - Times out at 15s by default; AbortSignal forwarded for cancellation.
|
|
9
|
+
* - Never logs request bodies (might contain refresh tokens / API keys).
|
|
10
|
+
*
|
|
11
|
+
* The wizard intentionally does NOT use a fancy HTTP client — fetch is built-in
|
|
12
|
+
* since Node 18 and the surface we need is tiny (POST/GET, JSON in/out).
|
|
13
|
+
*/
|
|
14
|
+
export type AuthMode = {
|
|
15
|
+
kind: 'none';
|
|
16
|
+
} | {
|
|
17
|
+
kind: 'bearer';
|
|
18
|
+
token: string;
|
|
19
|
+
} | {
|
|
20
|
+
kind: 'apiKey';
|
|
21
|
+
key: string;
|
|
22
|
+
};
|
|
23
|
+
export interface RequestInit {
|
|
24
|
+
method: 'GET' | 'POST' | 'PUT' | 'DELETE';
|
|
25
|
+
path: string;
|
|
26
|
+
/** Treated as JSON. */
|
|
27
|
+
body?: unknown;
|
|
28
|
+
query?: Record<string, string | number | boolean | undefined>;
|
|
29
|
+
auth: AuthMode;
|
|
30
|
+
/** Override default timeout (ms). */
|
|
31
|
+
timeoutMs?: number;
|
|
32
|
+
/** Forward an external abort signal (e.g. Ctrl+C). */
|
|
33
|
+
signal?: AbortSignal;
|
|
34
|
+
/** Override Content-Type — used by source-map upload (still JSON in body but custom MIME). */
|
|
35
|
+
contentType?: string;
|
|
36
|
+
}
|
|
37
|
+
export interface ApiResponse<T> {
|
|
38
|
+
status: number;
|
|
39
|
+
data: T;
|
|
40
|
+
/** True for 2xx. */
|
|
41
|
+
ok: boolean;
|
|
42
|
+
}
|
|
43
|
+
export declare function apiRequest<T>(host: string, init: RequestInit): Promise<ApiResponse<T>>;
|
|
44
|
+
//# sourceMappingURL=http.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/api/http.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;GAYG;AAEH,MAAM,MAAM,QAAQ,GAChB;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAChB;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACjC;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC;AAEpC,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,CAAC;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,uBAAuB;IACvB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC,CAAC;IAC9D,IAAI,EAAE,QAAQ,CAAC;IACf,qCAAqC;IACrC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sDAAsD;IACtD,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,8FAA8F;IAC9F,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,WAAW,CAAC,CAAC;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,CAAC,CAAC;IACR,oBAAoB;IACpB,EAAE,EAAE,OAAO,CAAC;CACb;AAID,wBAAsB,UAAU,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAsE5F"}
|
package/dist/api/http.js
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { WizardError } from '../util/errors.js';
|
|
2
|
+
const DEFAULT_TIMEOUT = 15_000;
|
|
3
|
+
export async function apiRequest(host, init) {
|
|
4
|
+
const url = buildUrl(host, init.path, init.query);
|
|
5
|
+
const headers = {
|
|
6
|
+
Accept: 'application/json',
|
|
7
|
+
'Content-Type': init.contentType ?? 'application/json',
|
|
8
|
+
'User-Agent': 'allstak-wizard',
|
|
9
|
+
};
|
|
10
|
+
if (init.auth.kind === 'bearer') {
|
|
11
|
+
headers.Authorization = `Bearer ${init.auth.token}`;
|
|
12
|
+
}
|
|
13
|
+
else if (init.auth.kind === 'apiKey') {
|
|
14
|
+
headers['X-AllStak-Key'] = init.auth.key;
|
|
15
|
+
}
|
|
16
|
+
const controller = new AbortController();
|
|
17
|
+
const externalSignal = init.signal;
|
|
18
|
+
const timeout = setTimeout(() => controller.abort(new Error('timeout')), init.timeoutMs ?? DEFAULT_TIMEOUT);
|
|
19
|
+
if (externalSignal) {
|
|
20
|
+
if (externalSignal.aborted)
|
|
21
|
+
controller.abort(externalSignal.reason);
|
|
22
|
+
else
|
|
23
|
+
externalSignal.addEventListener('abort', () => controller.abort(externalSignal.reason));
|
|
24
|
+
}
|
|
25
|
+
let res;
|
|
26
|
+
try {
|
|
27
|
+
res = await fetch(url, {
|
|
28
|
+
method: init.method,
|
|
29
|
+
headers,
|
|
30
|
+
body: init.body !== undefined ? JSON.stringify(init.body) : undefined,
|
|
31
|
+
signal: controller.signal,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
catch (err) {
|
|
35
|
+
clearTimeout(timeout);
|
|
36
|
+
if (err instanceof Error && /timeout/i.test(err.message)) {
|
|
37
|
+
throw new WizardError('E_NETWORK_FAILED', `Request to ${redactUrl(url)} timed out after ${(init.timeoutMs ?? DEFAULT_TIMEOUT) / 1000}s`, { subcode: 'E_HTTP_TIMEOUT', context: { method: init.method, path: init.path } });
|
|
38
|
+
}
|
|
39
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
40
|
+
throw new WizardError('E_NETWORK_FAILED', `Network error contacting ${redactUrl(url)}: ${msg}`, { subcode: 'E_HTTP_NETWORK', cause: err, context: { method: init.method, path: init.path } });
|
|
41
|
+
}
|
|
42
|
+
finally {
|
|
43
|
+
clearTimeout(timeout);
|
|
44
|
+
}
|
|
45
|
+
let parsed = null;
|
|
46
|
+
const text = await res.text();
|
|
47
|
+
if (text.length > 0) {
|
|
48
|
+
try {
|
|
49
|
+
parsed = JSON.parse(text);
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
// Some endpoints return text/plain on errors; preserve as a string.
|
|
53
|
+
parsed = text;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
if (res.ok) {
|
|
57
|
+
return { status: res.status, data: parsed, ok: true };
|
|
58
|
+
}
|
|
59
|
+
// Normalise backend error envelope.
|
|
60
|
+
const body = parsed;
|
|
61
|
+
const backendCode = body?.error?.code ?? `HTTP_${res.status}`;
|
|
62
|
+
const message = body?.error?.message ?? res.statusText ?? 'Unknown error';
|
|
63
|
+
const canonical = canonicalCodeFor(res.status, backendCode);
|
|
64
|
+
throw new WizardError(canonical, `[${res.status}] ${redactUrl(url)} — ${message}`, {
|
|
65
|
+
subcode: backendCode,
|
|
66
|
+
hint: hintFor(backendCode, res.status),
|
|
67
|
+
context: { status: res.status, method: init.method, path: init.path },
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
function canonicalCodeFor(status, backendCode) {
|
|
71
|
+
if (status === 401)
|
|
72
|
+
return 'E_AUTH_EXPIRED';
|
|
73
|
+
if (status === 403)
|
|
74
|
+
return 'E_PERMISSION_DENIED';
|
|
75
|
+
if (status === 404) {
|
|
76
|
+
if (/PROJECT|ORG/i.test(backendCode))
|
|
77
|
+
return 'E_PROJECT_NOT_FOUND';
|
|
78
|
+
return 'E_BACKEND_CONTRACT_MISSING';
|
|
79
|
+
}
|
|
80
|
+
if (status === 409 || status === 422)
|
|
81
|
+
return 'E_CONFIG_INVALID';
|
|
82
|
+
if (backendCode === 'INVALID_API_KEY')
|
|
83
|
+
return 'E_AUTH_FAILED';
|
|
84
|
+
if (backendCode === 'INVALID_OTP' || backendCode === 'OTP_RATE_LIMITED')
|
|
85
|
+
return 'E_AUTH_FAILED';
|
|
86
|
+
if (status >= 500)
|
|
87
|
+
return 'E_NETWORK_FAILED';
|
|
88
|
+
return 'E_NETWORK_FAILED';
|
|
89
|
+
}
|
|
90
|
+
function buildUrl(host, path, query) {
|
|
91
|
+
const base = host.endsWith('/') ? host.slice(0, -1) : host;
|
|
92
|
+
const p = path.startsWith('/') ? path : `/${path}`;
|
|
93
|
+
if (!query)
|
|
94
|
+
return `${base}${p}`;
|
|
95
|
+
const params = new URLSearchParams();
|
|
96
|
+
for (const [k, v] of Object.entries(query)) {
|
|
97
|
+
if (v === undefined || v === null)
|
|
98
|
+
continue;
|
|
99
|
+
params.append(k, String(v));
|
|
100
|
+
}
|
|
101
|
+
const qs = params.toString();
|
|
102
|
+
return qs ? `${base}${p}?${qs}` : `${base}${p}`;
|
|
103
|
+
}
|
|
104
|
+
function redactUrl(url) {
|
|
105
|
+
// Strip any token/api_key query — defensive even though we don't put secrets there.
|
|
106
|
+
return url.replace(/(token|key|api_key)=[^&]+/gi, '$1=***');
|
|
107
|
+
}
|
|
108
|
+
function hintFor(code, status) {
|
|
109
|
+
switch (code) {
|
|
110
|
+
case 'INVALID_API_KEY':
|
|
111
|
+
return 'Confirm the API key is for this project; rotate via the dashboard if it was leaked.';
|
|
112
|
+
case 'INVALID_OTP':
|
|
113
|
+
return 'OTP codes expire in ~10 minutes. Request a new one with `allstak login`.';
|
|
114
|
+
case 'OTP_RATE_LIMITED':
|
|
115
|
+
return 'Too many OTP requests for this email — wait a minute and retry.';
|
|
116
|
+
case 'TOKEN_EXPIRED':
|
|
117
|
+
return 'Your session has expired. Run `allstak login` again.';
|
|
118
|
+
default:
|
|
119
|
+
if (status === 401)
|
|
120
|
+
return 'Authentication failed. Run `allstak login` to refresh credentials.';
|
|
121
|
+
if (status === 403)
|
|
122
|
+
return 'You don\'t have access to this resource.';
|
|
123
|
+
if (status === 404)
|
|
124
|
+
return 'Resource not found — check org/project slugs.';
|
|
125
|
+
if (status >= 500)
|
|
126
|
+
return 'AllStak backend is currently degraded. Retry in a moment.';
|
|
127
|
+
return undefined;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
//# sourceMappingURL=http.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.js","sourceRoot":"","sources":["../../src/api/http.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CA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AAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9B,CAAC;IACD,MAAM,EAAE,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC;IAC7B,OAAO,EAAE,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,CAAC,EAAE,CAAC;AAClD,CAAC;AAED,SAAS,SAAS,CAAC,GAAW;IAC5B,oFAAoF;IACpF,OAAO,GAAG,CAAC,OAAO,CAAC,6BAA6B,EAAE,QAAQ,CAAC,CAAC;AAC9D,CAAC;AAED,SAAS,OAAO,CAAC,IAAY,EAAE,MAAc;IAC3C,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,iBAAiB;YACpB,OAAO,qFAAqF,CAAC;QAC/F,KAAK,aAAa;YAChB,OAAO,0EAA0E,CAAC;QACpF,KAAK,kBAAkB;YACrB,OAAO,iEAAiE,CAAC;QAC3E,KAAK,eAAe;YAClB,OAAO,sDAAsD,CAAC;QAChE;YACE,IAAI,MAAM,KAAK,GAAG;gBAAE,OAAO,oEAAoE,CAAC;YAChG,IAAI,MAAM,KAAK,GAAG;gBAAE,OAAO,0CAA0C,CAAC;YACtE,IAAI,MAAM,KAAK,GAAG;gBAAE,OAAO,+CAA+C,CAAC;YAC3E,IAAI,MAAM,IAAI,GAAG;gBAAE,OAAO,2DAA2D,CAAC;YACtF,OAAO,SAAS,CAAC;IACrB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Programmatic surface for the API layer. Each verb is an isolated function so
|
|
3
|
+
* downstream callers can mock individual endpoints without re-exporting our
|
|
4
|
+
* fetch wrapper.
|
|
5
|
+
*/
|
|
6
|
+
export { apiRequest, type AuthMode, type ApiResponse } from './http.js';
|
|
7
|
+
export { requestOtp, verifyOtp, verify2faLogin, refreshTokens, logout as logoutSession, whoami, } from './auth-client.js';
|
|
8
|
+
export { listOrgs, createOrg, getOrg } from './orgs-client.js';
|
|
9
|
+
export { listProjects, createProject, getProject, createApiKey, listApiKeys, } from './projects-client.js';
|
|
10
|
+
export { setupDoctor, sendTestEvent, pollForProbeEvent, } from './setup-doctor-client.js';
|
|
11
|
+
export * from './types.js';
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,UAAU,EAAE,KAAK,QAAQ,EAAE,KAAK,WAAW,EAAE,MAAM,WAAW,CAAC;AACxE,OAAO,EACL,UAAU,EACV,SAAS,EACT,cAAc,EACd,aAAa,EACb,MAAM,IAAI,aAAa,EACvB,MAAM,GACP,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EACL,YAAY,EACZ,aAAa,EACb,UAAU,EACV,YAAY,EACZ,WAAW,GACZ,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,WAAW,EACX,aAAa,EACb,iBAAiB,GAClB,MAAM,0BAA0B,CAAC;AAClC,cAAc,YAAY,CAAC"}
|