@marinoscar/platform-cli 0.1.0-next.3 → 0.1.0-next.4
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 +80 -0
- package/README.md +126 -31
- package/dist/android/build.d.ts +30 -0
- package/dist/android/build.d.ts.map +1 -0
- package/dist/android/build.js +126 -0
- package/dist/android/build.js.map +1 -0
- package/dist/android/command.d.ts +21 -0
- package/dist/android/command.d.ts.map +1 -0
- package/dist/android/command.js +355 -0
- package/dist/android/command.js.map +1 -0
- package/dist/android/deploy-step.d.ts +85 -0
- package/dist/android/deploy-step.d.ts.map +1 -0
- package/dist/android/deploy-step.js +268 -0
- package/dist/android/deploy-step.js.map +1 -0
- package/dist/android/doctor.d.ts +47 -0
- package/dist/android/doctor.d.ts.map +1 -0
- package/dist/android/doctor.js +219 -0
- package/dist/android/doctor.js.map +1 -0
- package/dist/android/exec.d.ts +42 -0
- package/dist/android/exec.d.ts.map +1 -0
- package/dist/android/exec.js +103 -0
- package/dist/android/exec.js.map +1 -0
- package/dist/android/fix-plan.d.ts +44 -0
- package/dist/android/fix-plan.d.ts.map +1 -0
- package/dist/android/fix-plan.js +86 -0
- package/dist/android/fix-plan.js.map +1 -0
- package/dist/android/git-freshness.d.ts +34 -0
- package/dist/android/git-freshness.d.ts.map +1 -0
- package/dist/android/git-freshness.js +120 -0
- package/dist/android/git-freshness.js.map +1 -0
- package/dist/android/gradle.d.ts +32 -0
- package/dist/android/gradle.d.ts.map +1 -0
- package/dist/android/gradle.js +55 -0
- package/dist/android/gradle.js.map +1 -0
- package/dist/android/identity.d.ts +27 -0
- package/dist/android/identity.d.ts.map +1 -0
- package/dist/android/identity.js +60 -0
- package/dist/android/identity.js.map +1 -0
- package/dist/android/index.d.ts +7 -0
- package/dist/android/index.d.ts.map +1 -0
- package/dist/android/index.js +8 -0
- package/dist/android/index.js.map +1 -0
- package/dist/android/installer.d.ts +28 -0
- package/dist/android/installer.d.ts.map +1 -0
- package/dist/android/installer.js +96 -0
- package/dist/android/installer.js.map +1 -0
- package/dist/android/java.d.ts +26 -0
- package/dist/android/java.d.ts.map +1 -0
- package/dist/android/java.js +65 -0
- package/dist/android/java.js.map +1 -0
- package/dist/android/keystore.d.ts +54 -0
- package/dist/android/keystore.d.ts.map +1 -0
- package/dist/android/keystore.js +159 -0
- package/dist/android/keystore.js.map +1 -0
- package/dist/android/metadata.d.ts +39 -0
- package/dist/android/metadata.d.ts.map +1 -0
- package/dist/android/metadata.js +61 -0
- package/dist/android/metadata.js.map +1 -0
- package/dist/android/operations.d.ts +42 -0
- package/dist/android/operations.d.ts.map +1 -0
- package/dist/android/operations.js +59 -0
- package/dist/android/operations.js.map +1 -0
- package/dist/android/paths.d.ts +29 -0
- package/dist/android/paths.d.ts.map +1 -0
- package/dist/android/paths.js +97 -0
- package/dist/android/paths.js.map +1 -0
- package/dist/android/publish.d.ts +37 -0
- package/dist/android/publish.d.ts.map +1 -0
- package/dist/android/publish.js +119 -0
- package/dist/android/publish.js.map +1 -0
- package/dist/android/registrations.d.ts +92 -0
- package/dist/android/registrations.d.ts.map +1 -0
- package/dist/android/registrations.js +112 -0
- package/dist/android/registrations.js.map +1 -0
- package/dist/android/release-status.d.ts +73 -0
- package/dist/android/release-status.d.ts.map +1 -0
- package/dist/android/release-status.js +161 -0
- package/dist/android/release-status.js.map +1 -0
- package/dist/android/release.d.ts +33 -0
- package/dist/android/release.d.ts.map +1 -0
- package/dist/android/release.js +59 -0
- package/dist/android/release.js.map +1 -0
- package/dist/android/screen-layout.d.ts +26 -0
- package/dist/android/screen-layout.d.ts.map +1 -0
- package/dist/android/screen-layout.js +24 -0
- package/dist/android/screen-layout.js.map +1 -0
- package/dist/android/screen-model.d.ts +56 -0
- package/dist/android/screen-model.d.ts.map +1 -0
- package/dist/android/screen-model.js +207 -0
- package/dist/android/screen-model.js.map +1 -0
- package/dist/android/screen.d.ts +8 -0
- package/dist/android/screen.d.ts.map +1 -0
- package/dist/android/screen.js +395 -0
- package/dist/android/screen.js.map +1 -0
- package/dist/android/sdk.d.ts +48 -0
- package/dist/android/sdk.d.ts.map +1 -0
- package/dist/android/sdk.js +82 -0
- package/dist/android/sdk.js.map +1 -0
- package/dist/android/server-url.d.ts +19 -0
- package/dist/android/server-url.d.ts.map +1 -0
- package/dist/android/server-url.js +36 -0
- package/dist/android/server-url.js.map +1 -0
- package/dist/android/upload-progress.d.ts +3 -0
- package/dist/android/upload-progress.d.ts.map +1 -0
- package/dist/android/upload-progress.js +47 -0
- package/dist/android/upload-progress.js.map +1 -0
- package/dist/android/version.d.ts +47 -0
- package/dist/android/version.d.ts.map +1 -0
- package/dist/android/version.js +136 -0
- package/dist/android/version.js.map +1 -0
- package/dist/api-client/index.d.ts +3 -0
- package/dist/api-client/index.d.ts.map +1 -0
- package/dist/api-client/index.js +5 -0
- package/dist/api-client/index.js.map +1 -0
- package/dist/commands/index.d.ts +52 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.js +63 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/core/cli-registry.d.ts +41 -0
- package/dist/core/cli-registry.d.ts.map +1 -0
- package/dist/core/cli-registry.js +49 -0
- package/dist/core/cli-registry.js.map +1 -0
- package/dist/core/command-registry.d.ts +10 -0
- package/dist/core/command-registry.d.ts.map +1 -1
- package/dist/core/command-registry.js +17 -0
- package/dist/core/command-registry.js.map +1 -1
- package/dist/core/env-annotation-registry.d.ts +58 -0
- package/dist/core/env-annotation-registry.d.ts.map +1 -0
- package/dist/core/env-annotation-registry.js +80 -0
- package/dist/core/env-annotation-registry.js.map +1 -0
- package/dist/core/env-generator-registry.d.ts +59 -0
- package/dist/core/env-generator-registry.d.ts.map +1 -0
- package/dist/core/env-generator-registry.js +102 -0
- package/dist/core/env-generator-registry.js.map +1 -0
- package/dist/core/env-group-registry.d.ts +65 -0
- package/dist/core/env-group-registry.d.ts.map +1 -0
- package/dist/core/env-group-registry.js +77 -0
- package/dist/core/env-group-registry.js.map +1 -0
- package/dist/core/env-spec-registry.d.ts +16 -2
- package/dist/core/env-spec-registry.d.ts.map +1 -1
- package/dist/core/env-spec-registry.js +15 -0
- package/dist/core/env-spec-registry.js.map +1 -1
- package/dist/core/env-values.d.ts +3 -2
- package/dist/core/env-values.d.ts.map +1 -1
- package/dist/core/env-values.js +5 -3
- package/dist/core/env-values.js.map +1 -1
- package/dist/core/index.d.ts +10 -2
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +6 -2
- package/dist/core/index.js.map +1 -1
- package/dist/deploy/index.d.ts +3 -0
- package/dist/deploy/index.d.ts.map +1 -0
- package/dist/deploy/index.js +5 -0
- package/dist/deploy/index.js.map +1 -0
- package/dist/engine/api-client.d.ts +211 -0
- package/dist/engine/api-client.d.ts.map +1 -0
- package/dist/engine/api-client.js +350 -0
- package/dist/engine/api-client.js.map +1 -0
- package/dist/engine/browser.d.ts +18 -0
- package/dist/engine/browser.d.ts.map +1 -0
- package/dist/engine/browser.js +115 -0
- package/dist/engine/browser.js.map +1 -0
- package/dist/engine/builtin-registrations.d.ts +20 -0
- package/dist/engine/builtin-registrations.d.ts.map +1 -0
- package/dist/engine/builtin-registrations.js +86 -0
- package/dist/engine/builtin-registrations.js.map +1 -0
- package/dist/engine/commands/api.d.ts +88 -0
- package/dist/engine/commands/api.d.ts.map +1 -0
- package/dist/engine/commands/api.js +398 -0
- package/dist/engine/commands/api.js.map +1 -0
- package/dist/engine/commands/config.d.ts +5 -0
- package/dist/engine/commands/config.d.ts.map +1 -0
- package/dist/engine/commands/config.js +83 -0
- package/dist/engine/commands/config.js.map +1 -0
- package/dist/engine/commands/deploy.d.ts +243 -0
- package/dist/engine/commands/deploy.d.ts.map +1 -0
- package/dist/engine/commands/deploy.js +1159 -0
- package/dist/engine/commands/deploy.js.map +1 -0
- package/dist/engine/commands/init.d.ts +18 -0
- package/dist/engine/commands/init.d.ts.map +1 -0
- package/dist/engine/commands/init.js +50 -0
- package/dist/engine/commands/init.js.map +1 -0
- package/dist/engine/commands/login.d.ts +4 -0
- package/dist/engine/commands/login.d.ts.map +1 -0
- package/dist/engine/commands/login.js +205 -0
- package/dist/engine/commands/login.js.map +1 -0
- package/dist/engine/commands/node.d.ts +21 -0
- package/dist/engine/commands/node.d.ts.map +1 -0
- package/dist/engine/commands/node.js +436 -0
- package/dist/engine/commands/node.js.map +1 -0
- package/dist/engine/config.d.ts +246 -0
- package/dist/engine/config.d.ts.map +1 -0
- package/dist/engine/config.js +414 -0
- package/dist/engine/config.js.map +1 -0
- package/dist/engine/conformance.d.ts +187 -0
- package/dist/engine/conformance.d.ts.map +1 -0
- package/dist/engine/conformance.js +227 -0
- package/dist/engine/conformance.js.map +1 -0
- package/dist/engine/create-cli.d.ts +94 -0
- package/dist/engine/create-cli.d.ts.map +1 -0
- package/dist/engine/create-cli.js +60 -0
- package/dist/engine/create-cli.js.map +1 -0
- package/dist/engine/deploy/about.d.ts +12 -0
- package/dist/engine/deploy/about.d.ts.map +1 -0
- package/dist/engine/deploy/about.js +110 -0
- package/dist/engine/deploy/about.js.map +1 -0
- package/dist/engine/deploy/adopt.d.ts +21 -0
- package/dist/engine/deploy/adopt.d.ts.map +1 -0
- package/dist/engine/deploy/adopt.js +78 -0
- package/dist/engine/deploy/adopt.js.map +1 -0
- package/dist/engine/deploy/answers-file.d.ts +7 -0
- package/dist/engine/deploy/answers-file.d.ts.map +1 -0
- package/dist/engine/deploy/answers-file.js +49 -0
- package/dist/engine/deploy/answers-file.js.map +1 -0
- package/dist/engine/deploy/app-role.d.ts +278 -0
- package/dist/engine/deploy/app-role.d.ts.map +1 -0
- package/dist/engine/deploy/app-role.js +826 -0
- package/dist/engine/deploy/app-role.js.map +1 -0
- package/dist/engine/deploy/app-version.d.ts +47 -0
- package/dist/engine/deploy/app-version.d.ts.map +1 -0
- package/dist/engine/deploy/app-version.js +232 -0
- package/dist/engine/deploy/app-version.js.map +1 -0
- package/dist/engine/deploy/checks/database.d.ts +83 -0
- package/dist/engine/deploy/checks/database.d.ts.map +1 -0
- package/dist/engine/deploy/checks/database.js +455 -0
- package/dist/engine/deploy/checks/database.js.map +1 -0
- package/dist/engine/deploy/checks/dns.d.ts +3 -0
- package/dist/engine/deploy/checks/dns.d.ts.map +1 -0
- package/dist/engine/deploy/checks/dns.js +85 -0
- package/dist/engine/deploy/checks/dns.js.map +1 -0
- package/dist/engine/deploy/checks/host.d.ts +19 -0
- package/dist/engine/deploy/checks/host.d.ts.map +1 -0
- package/dist/engine/deploy/checks/host.js +530 -0
- package/dist/engine/deploy/checks/host.js.map +1 -0
- package/dist/engine/deploy/checks/index.d.ts +33 -0
- package/dist/engine/deploy/checks/index.d.ts.map +1 -0
- package/dist/engine/deploy/checks/index.js +67 -0
- package/dist/engine/deploy/checks/index.js.map +1 -0
- package/dist/engine/deploy/checks/registry.d.ts +102 -0
- package/dist/engine/deploy/checks/registry.d.ts.map +1 -0
- package/dist/engine/deploy/checks/registry.js +103 -0
- package/dist/engine/deploy/checks/registry.js.map +1 -0
- package/dist/engine/deploy/checks/source.d.ts +45 -0
- package/dist/engine/deploy/checks/source.d.ts.map +1 -0
- package/dist/engine/deploy/checks/source.js +175 -0
- package/dist/engine/deploy/checks/source.js.map +1 -0
- package/dist/engine/deploy/checks/tls.d.ts +87 -0
- package/dist/engine/deploy/checks/tls.d.ts.map +1 -0
- package/dist/engine/deploy/checks/tls.js +552 -0
- package/dist/engine/deploy/checks/tls.js.map +1 -0
- package/dist/engine/deploy/checks/types.d.ts +178 -0
- package/dist/engine/deploy/checks/types.d.ts.map +1 -0
- package/dist/engine/deploy/checks/types.js +199 -0
- package/dist/engine/deploy/checks/types.js.map +1 -0
- package/dist/engine/deploy/compose-files.d.ts +29 -0
- package/dist/engine/deploy/compose-files.d.ts.map +1 -0
- package/dist/engine/deploy/compose-files.js +118 -0
- package/dist/engine/deploy/compose-files.js.map +1 -0
- package/dist/engine/deploy/consent.d.ts +29 -0
- package/dist/engine/deploy/consent.d.ts.map +1 -0
- package/dist/engine/deploy/consent.js +35 -0
- package/dist/engine/deploy/consent.js.map +1 -0
- package/dist/engine/deploy/database-drop.d.ts +22 -0
- package/dist/engine/deploy/database-drop.d.ts.map +1 -0
- package/dist/engine/deploy/database-drop.js +135 -0
- package/dist/engine/deploy/database-drop.js.map +1 -0
- package/dist/engine/deploy/database.d.ts +116 -0
- package/dist/engine/deploy/database.d.ts.map +1 -0
- package/dist/engine/deploy/database.js +252 -0
- package/dist/engine/deploy/database.js.map +1 -0
- package/dist/engine/deploy/deploy-info.d.ts +48 -0
- package/dist/engine/deploy/deploy-info.d.ts.map +1 -0
- package/dist/engine/deploy/deploy-info.js +163 -0
- package/dist/engine/deploy/deploy-info.js.map +1 -0
- package/dist/engine/deploy/deployment-evidence.d.ts +38 -0
- package/dist/engine/deploy/deployment-evidence.d.ts.map +1 -0
- package/dist/engine/deploy/deployment-evidence.js +92 -0
- package/dist/engine/deploy/deployment-evidence.js.map +1 -0
- package/dist/engine/deploy/edge-config.d.ts +103 -0
- package/dist/engine/deploy/edge-config.d.ts.map +1 -0
- package/dist/engine/deploy/edge-config.js +170 -0
- package/dist/engine/deploy/edge-config.js.map +1 -0
- package/dist/engine/deploy/env-absence.d.ts +61 -0
- package/dist/engine/deploy/env-absence.d.ts.map +1 -0
- package/dist/engine/deploy/env-absence.js +33 -0
- package/dist/engine/deploy/env-absence.js.map +1 -0
- package/dist/engine/deploy/env-file.d.ts +14 -0
- package/dist/engine/deploy/env-file.d.ts.map +1 -0
- package/dist/engine/deploy/env-file.js +58 -0
- package/dist/engine/deploy/env-file.js.map +1 -0
- package/dist/engine/deploy/env-fragments.d.ts +29 -0
- package/dist/engine/deploy/env-fragments.d.ts.map +1 -0
- package/dist/engine/deploy/env-fragments.js +73 -0
- package/dist/engine/deploy/env-fragments.js.map +1 -0
- package/dist/engine/deploy/env-metadata.d.ts +73 -0
- package/dist/engine/deploy/env-metadata.d.ts.map +1 -0
- package/dist/engine/deploy/env-metadata.js +227 -0
- package/dist/engine/deploy/env-metadata.js.map +1 -0
- package/dist/engine/deploy/env-spec.d.ts +75 -0
- package/dist/engine/deploy/env-spec.d.ts.map +1 -0
- package/dist/engine/deploy/env-spec.js +239 -0
- package/dist/engine/deploy/env-spec.js.map +1 -0
- package/dist/engine/deploy/env-wizard.d.ts +56 -0
- package/dist/engine/deploy/env-wizard.d.ts.map +1 -0
- package/dist/engine/deploy/env-wizard.js +235 -0
- package/dist/engine/deploy/env-wizard.js.map +1 -0
- package/dist/engine/deploy/executor.d.ts +81 -0
- package/dist/engine/deploy/executor.d.ts.map +1 -0
- package/dist/engine/deploy/executor.js +247 -0
- package/dist/engine/deploy/executor.js.map +1 -0
- package/dist/engine/deploy/health.d.ts +146 -0
- package/dist/engine/deploy/health.d.ts.map +1 -0
- package/dist/engine/deploy/health.js +323 -0
- package/dist/engine/deploy/health.js.map +1 -0
- package/dist/engine/deploy/hooks.d.ts +66 -0
- package/dist/engine/deploy/hooks.d.ts.map +1 -0
- package/dist/engine/deploy/hooks.js +19 -0
- package/dist/engine/deploy/hooks.js.map +1 -0
- package/dist/engine/deploy/host-facts.d.ts +23 -0
- package/dist/engine/deploy/host-facts.d.ts.map +1 -0
- package/dist/engine/deploy/host-facts.js +67 -0
- package/dist/engine/deploy/host-facts.js.map +1 -0
- package/dist/engine/deploy/install.d.ts +233 -0
- package/dist/engine/deploy/install.d.ts.map +1 -0
- package/dist/engine/deploy/install.js +1304 -0
- package/dist/engine/deploy/install.js.map +1 -0
- package/dist/engine/deploy/inventory.d.ts +30 -0
- package/dist/engine/deploy/inventory.d.ts.map +1 -0
- package/dist/engine/deploy/inventory.js +122 -0
- package/dist/engine/deploy/inventory.js.map +1 -0
- package/dist/engine/deploy/journal.d.ts +77 -0
- package/dist/engine/deploy/journal.d.ts.map +1 -0
- package/dist/engine/deploy/journal.js +221 -0
- package/dist/engine/deploy/journal.js.map +1 -0
- package/dist/engine/deploy/layout.d.ts +77 -0
- package/dist/engine/deploy/layout.d.ts.map +1 -0
- package/dist/engine/deploy/layout.js +191 -0
- package/dist/engine/deploy/layout.js.map +1 -0
- package/dist/engine/deploy/oauth-check.d.ts +58 -0
- package/dist/engine/deploy/oauth-check.d.ts.map +1 -0
- package/dist/engine/deploy/oauth-check.js +213 -0
- package/dist/engine/deploy/oauth-check.js.map +1 -0
- package/dist/engine/deploy/proxy-bootstrap.d.ts +149 -0
- package/dist/engine/deploy/proxy-bootstrap.d.ts.map +1 -0
- package/dist/engine/deploy/proxy-bootstrap.js +416 -0
- package/dist/engine/deploy/proxy-bootstrap.js.map +1 -0
- package/dist/engine/deploy/proxy-streams.d.ts +110 -0
- package/dist/engine/deploy/proxy-streams.d.ts.map +1 -0
- package/dist/engine/deploy/proxy-streams.js +208 -0
- package/dist/engine/deploy/proxy-streams.js.map +1 -0
- package/dist/engine/deploy/proxy.d.ts +375 -0
- package/dist/engine/deploy/proxy.d.ts.map +1 -0
- package/dist/engine/deploy/proxy.js +758 -0
- package/dist/engine/deploy/proxy.js.map +1 -0
- package/dist/engine/deploy/renewal.d.ts +54 -0
- package/dist/engine/deploy/renewal.d.ts.map +1 -0
- package/dist/engine/deploy/renewal.js +169 -0
- package/dist/engine/deploy/renewal.js.map +1 -0
- package/dist/engine/deploy/repo.d.ts +101 -0
- package/dist/engine/deploy/repo.d.ts.map +1 -0
- package/dist/engine/deploy/repo.js +250 -0
- package/dist/engine/deploy/repo.js.map +1 -0
- package/dist/engine/deploy/run-record.d.ts +28 -0
- package/dist/engine/deploy/run-record.d.ts.map +1 -0
- package/dist/engine/deploy/run-record.js +44 -0
- package/dist/engine/deploy/run-record.js.map +1 -0
- package/dist/engine/deploy/state.d.ts +262 -0
- package/dist/engine/deploy/state.d.ts.map +1 -0
- package/dist/engine/deploy/state.js +163 -0
- package/dist/engine/deploy/state.js.map +1 -0
- package/dist/engine/deploy/steps/app-step-context.d.ts +24 -0
- package/dist/engine/deploy/steps/app-step-context.d.ts.map +1 -0
- package/dist/engine/deploy/steps/app-step-context.js +45 -0
- package/dist/engine/deploy/steps/app-step-context.js.map +1 -0
- package/dist/engine/deploy/steps/pipeline.d.ts +46 -0
- package/dist/engine/deploy/steps/pipeline.d.ts.map +1 -0
- package/dist/engine/deploy/steps/pipeline.js +73 -0
- package/dist/engine/deploy/steps/pipeline.js.map +1 -0
- package/dist/engine/deploy/steps/plan.d.ts +28 -0
- package/dist/engine/deploy/steps/plan.d.ts.map +1 -0
- package/dist/engine/deploy/steps/plan.js +32 -0
- package/dist/engine/deploy/steps/plan.js.map +1 -0
- package/dist/engine/deploy/steps/registry.d.ts +182 -0
- package/dist/engine/deploy/steps/registry.d.ts.map +1 -0
- package/dist/engine/deploy/steps/registry.js +212 -0
- package/dist/engine/deploy/steps/registry.js.map +1 -0
- package/dist/engine/deploy/steps/step-values.d.ts +28 -0
- package/dist/engine/deploy/steps/step-values.d.ts.map +1 -0
- package/dist/engine/deploy/steps/step-values.js +33 -0
- package/dist/engine/deploy/steps/step-values.js.map +1 -0
- package/dist/engine/deploy/testing/fake-postgres.d.ts +88 -0
- package/dist/engine/deploy/testing/fake-postgres.d.ts.map +1 -0
- package/dist/engine/deploy/testing/fake-postgres.js +236 -0
- package/dist/engine/deploy/testing/fake-postgres.js.map +1 -0
- package/dist/engine/deploy/testing/fake-vps.d.ts +147 -0
- package/dist/engine/deploy/testing/fake-vps.d.ts.map +1 -0
- package/dist/engine/deploy/testing/fake-vps.js +365 -0
- package/dist/engine/deploy/testing/fake-vps.js.map +1 -0
- package/dist/engine/deploy/uninstall.d.ts +87 -0
- package/dist/engine/deploy/uninstall.d.ts.map +1 -0
- package/dist/engine/deploy/uninstall.js +320 -0
- package/dist/engine/deploy/uninstall.js.map +1 -0
- package/dist/engine/deploy/update.d.ts +111 -0
- package/dist/engine/deploy/update.d.ts.map +1 -0
- package/dist/engine/deploy/update.js +1228 -0
- package/dist/engine/deploy/update.js.map +1 -0
- package/dist/engine/deploy/version-step.d.ts +65 -0
- package/dist/engine/deploy/version-step.d.ts.map +1 -0
- package/dist/engine/deploy/version-step.js +176 -0
- package/dist/engine/deploy/version-step.js.map +1 -0
- package/dist/engine/device-auth.d.ts +240 -0
- package/dist/engine/device-auth.d.ts.map +1 -0
- package/dist/engine/device-auth.js +442 -0
- package/dist/engine/device-auth.js.map +1 -0
- package/dist/engine/device-login.d.ts +126 -0
- package/dist/engine/device-login.d.ts.map +1 -0
- package/dist/engine/device-login.js +164 -0
- package/dist/engine/device-login.js.map +1 -0
- package/dist/engine/errors.d.ts +314 -0
- package/dist/engine/errors.d.ts.map +1 -0
- package/dist/engine/errors.js +561 -0
- package/dist/engine/errors.js.map +1 -0
- package/dist/engine/identity.d.ts +169 -0
- package/dist/engine/identity.d.ts.map +1 -0
- package/dist/engine/identity.js +227 -0
- package/dist/engine/identity.js.map +1 -0
- package/dist/engine/index.d.ts +104 -0
- package/dist/engine/index.d.ts.map +1 -0
- package/dist/engine/index.js +126 -0
- package/dist/engine/index.js.map +1 -0
- package/dist/engine/init/local-profile.d.ts +93 -0
- package/dist/engine/init/local-profile.d.ts.map +1 -0
- package/dist/engine/init/local-profile.js +295 -0
- package/dist/engine/init/local-profile.js.map +1 -0
- package/dist/engine/init/run-init.d.ts +41 -0
- package/dist/engine/init/run-init.d.ts.map +1 -0
- package/dist/engine/init/run-init.js +297 -0
- package/dist/engine/init/run-init.js.map +1 -0
- package/dist/engine/node/capabilities.d.ts +238 -0
- package/dist/engine/node/capabilities.d.ts.map +1 -0
- package/dist/engine/node/capabilities.js +316 -0
- package/dist/engine/node/capabilities.js.map +1 -0
- package/dist/engine/node/daemon.d.ts +63 -0
- package/dist/engine/node/daemon.d.ts.map +1 -0
- package/dist/engine/node/daemon.js +227 -0
- package/dist/engine/node/daemon.js.map +1 -0
- package/dist/engine/node/doctor.d.ts +58 -0
- package/dist/engine/node/doctor.d.ts.map +1 -0
- package/dist/engine/node/doctor.js +394 -0
- package/dist/engine/node/doctor.js.map +1 -0
- package/dist/engine/node/enrollment.d.ts +98 -0
- package/dist/engine/node/enrollment.d.ts.map +1 -0
- package/dist/engine/node/enrollment.js +189 -0
- package/dist/engine/node/enrollment.js.map +1 -0
- package/dist/engine/node/env-flags.d.ts +5 -0
- package/dist/engine/node/env-flags.d.ts.map +1 -0
- package/dist/engine/node/env-flags.js +22 -0
- package/dist/engine/node/env-flags.js.map +1 -0
- package/dist/engine/node/executors/credential-hygiene.d.ts +63 -0
- package/dist/engine/node/executors/credential-hygiene.d.ts.map +1 -0
- package/dist/engine/node/executors/credential-hygiene.js +189 -0
- package/dist/engine/node/executors/credential-hygiene.js.map +1 -0
- package/dist/engine/node/executors/db-backup-run.d.ts +73 -0
- package/dist/engine/node/executors/db-backup-run.d.ts.map +1 -0
- package/dist/engine/node/executors/db-backup-run.js +362 -0
- package/dist/engine/node/executors/db-backup-run.js.map +1 -0
- package/dist/engine/node/executors/example-checksum.d.ts +30 -0
- package/dist/engine/node/executors/example-checksum.d.ts.map +1 -0
- package/dist/engine/node/executors/example-checksum.js +56 -0
- package/dist/engine/node/executors/example-checksum.js.map +1 -0
- package/dist/engine/node/executors/index.d.ts +168 -0
- package/dist/engine/node/executors/index.d.ts.map +1 -0
- package/dist/engine/node/executors/index.js +44 -0
- package/dist/engine/node/executors/index.js.map +1 -0
- package/dist/engine/node/executors/registry.d.ts +38 -0
- package/dist/engine/node/executors/registry.d.ts.map +1 -0
- package/dist/engine/node/executors/registry.js +92 -0
- package/dist/engine/node/executors/registry.js.map +1 -0
- package/dist/engine/node/heap-snapshot.d.ts +37 -0
- package/dist/engine/node/heap-snapshot.d.ts.map +1 -0
- package/dist/engine/node/heap-snapshot.js +160 -0
- package/dist/engine/node/heap-snapshot.js.map +1 -0
- package/dist/engine/node/install-deps.d.ts +73 -0
- package/dist/engine/node/install-deps.d.ts.map +1 -0
- package/dist/engine/node/install-deps.js +150 -0
- package/dist/engine/node/install-deps.js.map +1 -0
- package/dist/engine/node/ipc-protocol.d.ts +67 -0
- package/dist/engine/node/ipc-protocol.d.ts.map +1 -0
- package/dist/engine/node/ipc-protocol.js +83 -0
- package/dist/engine/node/ipc-protocol.js.map +1 -0
- package/dist/engine/node/lifecycle.d.ts +103 -0
- package/dist/engine/node/lifecycle.d.ts.map +1 -0
- package/dist/engine/node/lifecycle.js +259 -0
- package/dist/engine/node/lifecycle.js.map +1 -0
- package/dist/engine/node/logger.d.ts +82 -0
- package/dist/engine/node/logger.d.ts.map +1 -0
- package/dist/engine/node/logger.js +241 -0
- package/dist/engine/node/logger.js.map +1 -0
- package/dist/engine/node/memory-watchdog.d.ts +78 -0
- package/dist/engine/node/memory-watchdog.d.ts.map +1 -0
- package/dist/engine/node/memory-watchdog.js +224 -0
- package/dist/engine/node/memory-watchdog.js.map +1 -0
- package/dist/engine/node/node-api.d.ts +391 -0
- package/dist/engine/node/node-api.d.ts.map +1 -0
- package/dist/engine/node/node-api.js +123 -0
- package/dist/engine/node/node-api.js.map +1 -0
- package/dist/engine/node/node-config.d.ts +128 -0
- package/dist/engine/node/node-config.d.ts.map +1 -0
- package/dist/engine/node/node-config.js +237 -0
- package/dist/engine/node/node-config.js.map +1 -0
- package/dist/engine/node/node-dashboard-source.d.ts +56 -0
- package/dist/engine/node/node-dashboard-source.d.ts.map +1 -0
- package/dist/engine/node/node-dashboard-source.js +213 -0
- package/dist/engine/node/node-dashboard-source.js.map +1 -0
- package/dist/engine/node/node-engine.d.ts +229 -0
- package/dist/engine/node/node-engine.d.ts.map +1 -0
- package/dist/engine/node/node-engine.js +723 -0
- package/dist/engine/node/node-engine.js.map +1 -0
- package/dist/engine/node/node-errors.d.ts +54 -0
- package/dist/engine/node/node-errors.d.ts.map +1 -0
- package/dist/engine/node/node-errors.js +71 -0
- package/dist/engine/node/node-errors.js.map +1 -0
- package/dist/engine/node/node-events.d.ts +132 -0
- package/dist/engine/node/node-events.d.ts.map +1 -0
- package/dist/engine/node/node-events.js +2 -0
- package/dist/engine/node/node-events.js.map +1 -0
- package/dist/engine/node/node-vitals.d.ts +123 -0
- package/dist/engine/node/node-vitals.d.ts.map +1 -0
- package/dist/engine/node/node-vitals.js +266 -0
- package/dist/engine/node/node-vitals.js.map +1 -0
- package/dist/engine/node/paths.d.ts +39 -0
- package/dist/engine/node/paths.d.ts.map +1 -0
- package/dist/engine/node/paths.js +60 -0
- package/dist/engine/node/paths.js.map +1 -0
- package/dist/engine/node/pg-dump.d.ts +126 -0
- package/dist/engine/node/pg-dump.d.ts.map +1 -0
- package/dist/engine/node/pg-dump.js +223 -0
- package/dist/engine/node/pg-dump.js.map +1 -0
- package/dist/engine/node/pidfile.d.ts +38 -0
- package/dist/engine/node/pidfile.d.ts.map +1 -0
- package/dist/engine/node/pidfile.js +156 -0
- package/dist/engine/node/pidfile.js.map +1 -0
- package/dist/engine/node/runtime-tuning.d.ts +65 -0
- package/dist/engine/node/runtime-tuning.d.ts.map +1 -0
- package/dist/engine/node/runtime-tuning.js +198 -0
- package/dist/engine/node/runtime-tuning.js.map +1 -0
- package/dist/engine/node/service.d.ts +39 -0
- package/dist/engine/node/service.d.ts.map +1 -0
- package/dist/engine/node/service.js +211 -0
- package/dist/engine/node/service.js.map +1 -0
- package/dist/engine/node/start.d.ts +62 -0
- package/dist/engine/node/start.d.ts.map +1 -0
- package/dist/engine/node/start.js +245 -0
- package/dist/engine/node/start.js.map +1 -0
- package/dist/engine/node/worker-env-table.d.ts +15 -0
- package/dist/engine/node/worker-env-table.d.ts.map +1 -0
- package/dist/engine/node/worker-env-table.js +97 -0
- package/dist/engine/node/worker-env-table.js.map +1 -0
- package/dist/engine/node/worker-env.d.ts +50 -0
- package/dist/engine/node/worker-env.d.ts.map +1 -0
- package/dist/engine/node/worker-env.js +101 -0
- package/dist/engine/node/worker-env.js.map +1 -0
- package/dist/engine/output.d.ts +97 -0
- package/dist/engine/output.d.ts.map +1 -0
- package/dist/engine/output.js +274 -0
- package/dist/engine/output.js.map +1 -0
- package/dist/engine/package-info.d.ts +7 -0
- package/dist/engine/package-info.d.ts.map +1 -0
- package/dist/engine/package-info.js +38 -0
- package/dist/engine/package-info.js.map +1 -0
- package/dist/engine/program.d.ts +50 -0
- package/dist/engine/program.d.ts.map +1 -0
- package/dist/engine/program.js +197 -0
- package/dist/engine/program.js.map +1 -0
- package/dist/engine/prompt.d.ts +69 -0
- package/dist/engine/prompt.d.ts.map +1 -0
- package/dist/engine/prompt.js +205 -0
- package/dist/engine/prompt.js.map +1 -0
- package/dist/engine/registries.d.ts +5 -0
- package/dist/engine/registries.d.ts.map +1 -0
- package/dist/engine/registries.js +52 -0
- package/dist/engine/registries.js.map +1 -0
- package/dist/engine/request-body.d.ts +31 -0
- package/dist/engine/request-body.d.ts.map +1 -0
- package/dist/engine/request-body.js +156 -0
- package/dist/engine/request-body.js.map +1 -0
- package/dist/engine/test-support.d.ts +50 -0
- package/dist/engine/test-support.d.ts.map +1 -0
- package/dist/engine/test-support.js +86 -0
- package/dist/engine/test-support.js.map +1 -0
- package/dist/engine/tui/app.d.ts +3 -0
- package/dist/engine/tui/app.d.ts.map +1 -0
- package/dist/engine/tui/app.js +100 -0
- package/dist/engine/tui/app.js.map +1 -0
- package/dist/engine/tui/builtin-screens.d.ts +6 -0
- package/dist/engine/tui/builtin-screens.d.ts.map +1 -0
- package/dist/engine/tui/builtin-screens.js +54 -0
- package/dist/engine/tui/builtin-screens.js.map +1 -0
- package/dist/engine/tui/index.d.ts +23 -0
- package/dist/engine/tui/index.d.ts.map +1 -0
- package/dist/engine/tui/index.js +71 -0
- package/dist/engine/tui/index.js.map +1 -0
- package/dist/engine/tui/layout.d.ts +132 -0
- package/dist/engine/tui/layout.d.ts.map +1 -0
- package/dist/engine/tui/layout.js +200 -0
- package/dist/engine/tui/layout.js.map +1 -0
- package/dist/engine/tui/routes.d.ts +5 -0
- package/dist/engine/tui/routes.d.ts.map +1 -0
- package/dist/engine/tui/routes.js +16 -0
- package/dist/engine/tui/routes.js.map +1 -0
- package/dist/engine/tui/screen-registry.d.ts +100 -0
- package/dist/engine/tui/screen-registry.d.ts.map +1 -0
- package/dist/engine/tui/screen-registry.js +96 -0
- package/dist/engine/tui/screen-registry.js.map +1 -0
- package/dist/engine/tui/screen-sections.d.ts +9 -0
- package/dist/engine/tui/screen-sections.d.ts.map +1 -0
- package/dist/engine/tui/screen-sections.js +45 -0
- package/dist/engine/tui/screen-sections.js.map +1 -0
- package/dist/engine/tui/screens/deploy/advanced-model.d.ts +69 -0
- package/dist/engine/tui/screens/deploy/advanced-model.d.ts.map +1 -0
- package/dist/engine/tui/screens/deploy/advanced-model.js +228 -0
- package/dist/engine/tui/screens/deploy/advanced-model.js.map +1 -0
- package/dist/engine/tui/screens/deploy/doctor-model.d.ts +37 -0
- package/dist/engine/tui/screens/deploy/doctor-model.d.ts.map +1 -0
- package/dist/engine/tui/screens/deploy/doctor-model.js +89 -0
- package/dist/engine/tui/screens/deploy/doctor-model.js.map +1 -0
- package/dist/engine/tui/screens/deploy/doctor.d.ts +8 -0
- package/dist/engine/tui/screens/deploy/doctor.d.ts.map +1 -0
- package/dist/engine/tui/screens/deploy/doctor.js +153 -0
- package/dist/engine/tui/screens/deploy/doctor.js.map +1 -0
- package/dist/engine/tui/screens/deploy/fields.d.ts +123 -0
- package/dist/engine/tui/screens/deploy/fields.d.ts.map +1 -0
- package/dist/engine/tui/screens/deploy/fields.js +202 -0
- package/dist/engine/tui/screens/deploy/fields.js.map +1 -0
- package/dist/engine/tui/screens/deploy/flags-model.d.ts +67 -0
- package/dist/engine/tui/screens/deploy/flags-model.d.ts.map +1 -0
- package/dist/engine/tui/screens/deploy/flags-model.js +302 -0
- package/dist/engine/tui/screens/deploy/flags-model.js.map +1 -0
- package/dist/engine/tui/screens/deploy/index.d.ts +6 -0
- package/dist/engine/tui/screens/deploy/index.d.ts.map +1 -0
- package/dist/engine/tui/screens/deploy/index.js +83 -0
- package/dist/engine/tui/screens/deploy/index.js.map +1 -0
- package/dist/engine/tui/screens/deploy/install-model.d.ts +159 -0
- package/dist/engine/tui/screens/deploy/install-model.d.ts.map +1 -0
- package/dist/engine/tui/screens/deploy/install-model.js +319 -0
- package/dist/engine/tui/screens/deploy/install-model.js.map +1 -0
- package/dist/engine/tui/screens/deploy/install.d.ts +8 -0
- package/dist/engine/tui/screens/deploy/install.d.ts.map +1 -0
- package/dist/engine/tui/screens/deploy/install.js +361 -0
- package/dist/engine/tui/screens/deploy/install.js.map +1 -0
- package/dist/engine/tui/screens/deploy/model.d.ts +49 -0
- package/dist/engine/tui/screens/deploy/model.d.ts.map +1 -0
- package/dist/engine/tui/screens/deploy/model.js +59 -0
- package/dist/engine/tui/screens/deploy/model.js.map +1 -0
- package/dist/engine/tui/screens/deploy/run-model.d.ts +58 -0
- package/dist/engine/tui/screens/deploy/run-model.d.ts.map +1 -0
- package/dist/engine/tui/screens/deploy/run-model.js +117 -0
- package/dist/engine/tui/screens/deploy/run-model.js.map +1 -0
- package/dist/engine/tui/screens/deploy/run.d.ts +75 -0
- package/dist/engine/tui/screens/deploy/run.d.ts.map +1 -0
- package/dist/engine/tui/screens/deploy/run.js +201 -0
- package/dist/engine/tui/screens/deploy/run.js.map +1 -0
- package/dist/engine/tui/screens/deploy/status.d.ts +17 -0
- package/dist/engine/tui/screens/deploy/status.d.ts.map +1 -0
- package/dist/engine/tui/screens/deploy/status.js +107 -0
- package/dist/engine/tui/screens/deploy/status.js.map +1 -0
- package/dist/engine/tui/screens/deploy/update.d.ts +41 -0
- package/dist/engine/tui/screens/deploy/update.d.ts.map +1 -0
- package/dist/engine/tui/screens/deploy/update.js +175 -0
- package/dist/engine/tui/screens/deploy/update.js.map +1 -0
- package/dist/engine/tui/screens/deploy.d.ts +12 -0
- package/dist/engine/tui/screens/deploy.d.ts.map +1 -0
- package/dist/engine/tui/screens/deploy.js +23 -0
- package/dist/engine/tui/screens/deploy.js.map +1 -0
- package/dist/engine/tui/screens/invoke.d.ts +6 -0
- package/dist/engine/tui/screens/invoke.d.ts.map +1 -0
- package/dist/engine/tui/screens/invoke.js +193 -0
- package/dist/engine/tui/screens/invoke.js.map +1 -0
- package/dist/engine/tui/screens/login.d.ts +6 -0
- package/dist/engine/tui/screens/login.d.ts.map +1 -0
- package/dist/engine/tui/screens/login.js +255 -0
- package/dist/engine/tui/screens/login.js.map +1 -0
- package/dist/engine/tui/screens/logout.d.ts +6 -0
- package/dist/engine/tui/screens/logout.d.ts.map +1 -0
- package/dist/engine/tui/screens/logout.js +142 -0
- package/dist/engine/tui/screens/logout.js.map +1 -0
- package/dist/engine/tui/screens/menu.d.ts +22 -0
- package/dist/engine/tui/screens/menu.d.ts.map +1 -0
- package/dist/engine/tui/screens/menu.js +84 -0
- package/dist/engine/tui/screens/menu.js.map +1 -0
- package/dist/engine/tui/screens/node.d.ts +6 -0
- package/dist/engine/tui/screens/node.d.ts.map +1 -0
- package/dist/engine/tui/screens/node.js +228 -0
- package/dist/engine/tui/screens/node.js.map +1 -0
- package/dist/engine/tui/screens/status.d.ts +6 -0
- package/dist/engine/tui/screens/status.d.ts.map +1 -0
- package/dist/engine/tui/screens/status.js +134 -0
- package/dist/engine/tui/screens/status.js.map +1 -0
- package/dist/engine/tui/scroll-box.d.ts +27 -0
- package/dist/engine/tui/scroll-box.d.ts.map +1 -0
- package/dist/engine/tui/scroll-box.js +52 -0
- package/dist/engine/tui/scroll-box.js.map +1 -0
- package/dist/engine/tui/section-registry.d.ts +65 -0
- package/dist/engine/tui/section-registry.d.ts.map +1 -0
- package/dist/engine/tui/section-registry.js +90 -0
- package/dist/engine/tui/section-registry.js.map +1 -0
- package/dist/engine/tui/terminal.d.ts +31 -0
- package/dist/engine/tui/terminal.d.ts.map +1 -0
- package/dist/engine/tui/terminal.js +142 -0
- package/dist/engine/tui/terminal.js.map +1 -0
- package/dist/engine/tui/tty.d.ts +49 -0
- package/dist/engine/tui/tty.d.ts.map +1 -0
- package/dist/engine/tui/tty.js +139 -0
- package/dist/engine/tui/tty.js.map +1 -0
- package/dist/index.d.ts +4 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/dist/node/index.d.ts +3 -0
- package/dist/node/index.d.ts.map +1 -0
- package/dist/node/index.js +5 -0
- package/dist/node/index.js.map +1 -0
- package/dist/telemetry/index.d.ts +2 -1
- package/dist/telemetry/index.d.ts.map +1 -1
- package/dist/telemetry/index.js +1 -0
- package/dist/telemetry/index.js.map +1 -1
- package/dist/telemetry/node-span-relay.d.ts +1 -1
- package/dist/telemetry/node-span-relay.d.ts.map +1 -1
- package/dist/telemetry/node-span-relay.js +39 -6
- package/dist/telemetry/node-span-relay.js.map +1 -1
- package/dist/telemetry/node-span.d.ts +39 -7
- package/dist/telemetry/node-span.d.ts.map +1 -1
- package/dist/telemetry/node-span.js +19 -1
- package/dist/telemetry/node-span.js.map +1 -1
- package/dist/testing/index.d.ts +3 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +4 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/tui/index.d.ts +3 -0
- package/dist/tui/index.d.ts.map +1 -0
- package/dist/tui/index.js +5 -0
- package/dist/tui/index.js.map +1 -0
- package/package.json +43 -5
|
@@ -0,0 +1,442 @@
|
|
|
1
|
+
import { cliName } from './identity.js';
|
|
2
|
+
import { ApiError, CliError, EXIT } from './errors.js';
|
|
3
|
+
// =============================================================================
|
|
4
|
+
// RFC 8628 device-authorization polling (issue #142, epic #110)
|
|
5
|
+
// =============================================================================
|
|
6
|
+
//
|
|
7
|
+
// This module is the state machine and NOTHING ELSE: no prompting, no browser,
|
|
8
|
+
// no terminal output, no config writing. It takes an ApiClient and a device
|
|
9
|
+
// code and returns a credential or throws a classified failure. That
|
|
10
|
+
// separation is what lets #145's ink TUI drive the identical flow — and it is
|
|
11
|
+
// what lets every outcome below be tested without a socket, a clock, or a
|
|
12
|
+
// terminal.
|
|
13
|
+
//
|
|
14
|
+
// -----------------------------------------------------------------------------
|
|
15
|
+
// WHY THE FOUR OUTCOMES ARE NOT ONE "login failed"
|
|
16
|
+
// -----------------------------------------------------------------------------
|
|
17
|
+
// RFC 8628 §3.5 defines the poll response as a set of distinct errors, and
|
|
18
|
+
// they map to four DIFFERENT THINGS THE USER MUST DO:
|
|
19
|
+
//
|
|
20
|
+
// authorization_pending do nothing. This is the normal case and it is the
|
|
21
|
+
// overwhelming majority of every poll response in a
|
|
22
|
+
// successful login. Reporting it as a failure makes
|
|
23
|
+
// the command unusable.
|
|
24
|
+
// slow_down WE must poll less often. Ignoring it is not a
|
|
25
|
+
// cosmetic bug: the server is rate-limiting, and a
|
|
26
|
+
// client that keeps hammering at the old interval can
|
|
27
|
+
// be throttled or blocked outright — so the fix is to
|
|
28
|
+
// WIDEN the interval, not to retry sooner.
|
|
29
|
+
// expired_token the code timed out. Run `login` again. Silently
|
|
30
|
+
// restarting the flow here would be wrong: a new code
|
|
31
|
+
// means a new user code, and the one on the user's
|
|
32
|
+
// screen would stop working with no explanation.
|
|
33
|
+
// access_denied the user pressed Deny. Say so and STOP. Retrying
|
|
34
|
+
// re-prompts a person who just said no.
|
|
35
|
+
//
|
|
36
|
+
// And a fifth, which the RFC does not cover because it is below the protocol:
|
|
37
|
+
// a NETWORK FAILURE. A dropped WiFi connection during the wait must not read
|
|
38
|
+
// as "you denied the request". NetworkError from the api-client already
|
|
39
|
+
// carries that distinction; this module simply must not swallow it.
|
|
40
|
+
// -----------------------------------------------------------------------------
|
|
41
|
+
// ⚠ KNOWN SERVER-SIDE DEFECT — READ BEFORE CHANGING `classifyPollFailure`
|
|
42
|
+
// -----------------------------------------------------------------------------
|
|
43
|
+
// As of this writing the API DOES NOT PUT THESE CODES ON THE WIRE.
|
|
44
|
+
// `DeviceAuthService.pollForToken` throws
|
|
45
|
+
// `BadRequestException({ error, error_description })`, but the global
|
|
46
|
+
// `HttpExceptionFilter` (@marinoscar/platform-api/core, src/core/errors/)
|
|
47
|
+
// only copies `message`, `code` and `details` out of an exception's response
|
|
48
|
+
// body. `{ error, error_description }` has no `message`, so the filter falls
|
|
49
|
+
// through to its default and every one of the four outcomes reaches a client
|
|
50
|
+
// as the byte-identical:
|
|
51
|
+
//
|
|
52
|
+
// { "statusCode": 400, "code": "BAD_REQUEST",
|
|
53
|
+
// "message": "An unexpected error occurred", ... }
|
|
54
|
+
//
|
|
55
|
+
// The RFC code is destroyed by the server before it is ever sent. No client
|
|
56
|
+
// can distinguish the four, and no amount of parsing on this side recovers
|
|
57
|
+
// information that was discarded upstream. That is an API bug, it needs its
|
|
58
|
+
// own issue, and it must be fixed for #142's success criterion 3 to hold.
|
|
59
|
+
//
|
|
60
|
+
// The classifier below is written against the CORRECT wire format so it starts
|
|
61
|
+
// working the moment the filter preserves `error` — and `UNCLASSIFIED_*`
|
|
62
|
+
// documents exactly what the CLI does in the meantime, and what it costs.
|
|
63
|
+
// =============================================================================
|
|
64
|
+
/** The RFC 8628 §3.5 error codes this client acts on. */
|
|
65
|
+
export const DEVICE_POLL_ERROR_CODES = [
|
|
66
|
+
'authorization_pending',
|
|
67
|
+
'slow_down',
|
|
68
|
+
'expired_token',
|
|
69
|
+
'access_denied',
|
|
70
|
+
// Not in the "pending" family: RFC 6749 §5.2. This API raises it (as a 401)
|
|
71
|
+
// for an unknown device code and for one that has already been redeemed.
|
|
72
|
+
'invalid_grant',
|
|
73
|
+
];
|
|
74
|
+
/**
|
|
75
|
+
* A device login that ended without a credential, carrying WHICH of the
|
|
76
|
+
* distinct outcomes it was.
|
|
77
|
+
*
|
|
78
|
+
* The `reason` is on the error rather than only in the message so the TUI
|
|
79
|
+
* (#145) can render four different screens from the same thrown value that
|
|
80
|
+
* the plain command turns into four different sentences. A caller that
|
|
81
|
+
* pattern-matches on message text would break the first time the wording is
|
|
82
|
+
* improved.
|
|
83
|
+
*
|
|
84
|
+
* THE EXIT CODES SPLIT ON WHETHER RETRYING IS SANE, which is the distinction
|
|
85
|
+
* errors.ts draws for EXIT.AUTH ("the one failure a script can automate: run
|
|
86
|
+
* login again"):
|
|
87
|
+
* - `expired` and `cancelled` → AUTH. Re-running the flow is exactly right;
|
|
88
|
+
* nothing was decided, the clock just ran out.
|
|
89
|
+
* - `denied` → API. A human said no. A script that retries on this is
|
|
90
|
+
* re-prompting someone who already refused, and that is harassment by
|
|
91
|
+
* automation, not resilience.
|
|
92
|
+
* - `invalid_grant` / `unclassified` → API. The server refused or answered
|
|
93
|
+
* something we do not understand; a retry loop would not help.
|
|
94
|
+
*/
|
|
95
|
+
export class DeviceLoginError extends CliError {
|
|
96
|
+
reason;
|
|
97
|
+
constructor(reason, message, options) {
|
|
98
|
+
super(message, options);
|
|
99
|
+
this.reason = reason;
|
|
100
|
+
}
|
|
101
|
+
get exitCode() {
|
|
102
|
+
return this.reason === 'expired' || this.reason === 'cancelled' ? EXIT.AUTH : EXIT.API;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
// -----------------------------------------------------------------------------
|
|
106
|
+
// Tuning
|
|
107
|
+
// -----------------------------------------------------------------------------
|
|
108
|
+
/**
|
|
109
|
+
* Seconds added to the interval on every `slow_down`.
|
|
110
|
+
*
|
|
111
|
+
* Five, because RFC 8628 §3.5 says five: "the client MUST increase the
|
|
112
|
+
* interval by 5 seconds". Additive, not exponential — the server has already
|
|
113
|
+
* told us the right order of magnitude via `interval`, so backing off
|
|
114
|
+
* geometrically would overshoot into "the code expires while we are asleep".
|
|
115
|
+
*/
|
|
116
|
+
export const SLOW_DOWN_INCREMENT_SECONDS = 5;
|
|
117
|
+
/**
|
|
118
|
+
* Ceiling on the interval.
|
|
119
|
+
*
|
|
120
|
+
* A server that answers `slow_down` unconditionally — a misconfigured rate
|
|
121
|
+
* limiter, a shared cache key — would otherwise widen the interval without
|
|
122
|
+
* bound until the device code expires during a single sleep, and the user
|
|
123
|
+
* would watch a code that is already dead. Capping means we keep polling often
|
|
124
|
+
* enough to observe the approval, and the deadline check ends the flow with
|
|
125
|
+
* the honest "expired" message rather than a hang.
|
|
126
|
+
*/
|
|
127
|
+
export const MAX_POLL_INTERVAL_SECONDS = 60;
|
|
128
|
+
/**
|
|
129
|
+
* Padding added to every sleep, milliseconds.
|
|
130
|
+
*
|
|
131
|
+
* NOT superstition. This API's rate limiter (`DeviceAuthService.pollForToken`)
|
|
132
|
+
* compares `now - lastPoll < pollInterval * 1000` — a STRICT less-than against
|
|
133
|
+
* the SAME configured value it advertises as `interval`. A client that sleeps
|
|
134
|
+
* exactly `interval` therefore sits precisely on the boundary, and any
|
|
135
|
+
* rounding in `setTimeout`, any scheduler jitter, or a timer that fires a
|
|
136
|
+
* millisecond early lands on the wrong side of it and earns a `slow_down` on
|
|
137
|
+
* every single poll. We would then widen the interval repeatedly for a
|
|
138
|
+
* condition that was our own timing, not the server's load. A quarter of a
|
|
139
|
+
* second is invisible to a human waiting on a browser approval and puts us
|
|
140
|
+
* unambiguously past the comparison.
|
|
141
|
+
*/
|
|
142
|
+
export const POLL_MARGIN_MS = 250;
|
|
143
|
+
/**
|
|
144
|
+
* How an unclassifiable 4xx from the poll endpoint is treated.
|
|
145
|
+
*
|
|
146
|
+
* `'pending'`, and it is a WORKAROUND for the server defect documented at the
|
|
147
|
+
* top of this file, not a design choice. Stated plainly, with its cost:
|
|
148
|
+
*
|
|
149
|
+
* - Choosing `'fatal'` would be the honest reading of an unknown response,
|
|
150
|
+
* and against the current API it makes `login` impossible: every poll
|
|
151
|
+
* before approval is an unclassifiable 400, so the command would die
|
|
152
|
+
* one interval into a flow that was working perfectly.
|
|
153
|
+
* - Choosing `'pending'` keeps login functional end to end today (epic #110
|
|
154
|
+
* success criterion 1) and degrades ONLY the outcomes we cannot see: with
|
|
155
|
+
* the filter as it stands, a denial and an expiry are indistinguishable
|
|
156
|
+
* from waiting, so both surface as the local deadline elapsing — "the code
|
|
157
|
+
* expired, run login again" — instead of "you denied it". That is a wrong
|
|
158
|
+
* message on two paths, versus a broken command on all of them.
|
|
159
|
+
*
|
|
160
|
+
* The exposure is BOUNDED, which is what makes it acceptable at all: the loop
|
|
161
|
+
* stops at the device code's own `expiresIn` regardless, so the worst case is
|
|
162
|
+
* a wait of the code's lifetime, not a hang. `onUnclassified` fires once so
|
|
163
|
+
* the user is told the CLI is flying blind rather than silently guessing.
|
|
164
|
+
*
|
|
165
|
+
* DELETE THIS AND SET IT FATAL once the API preserves `error` — the classifier
|
|
166
|
+
* needs no other change.
|
|
167
|
+
*/
|
|
168
|
+
export const UNCLASSIFIED_POLL_POLICY = 'pending';
|
|
169
|
+
// -----------------------------------------------------------------------------
|
|
170
|
+
// Requesting a code
|
|
171
|
+
// -----------------------------------------------------------------------------
|
|
172
|
+
/**
|
|
173
|
+
* `POST /api/auth/device/code`.
|
|
174
|
+
*
|
|
175
|
+
* `tokenType: 'pat'` is the whole reason #141 exists. Without it the server
|
|
176
|
+
* defaults to `'session'` and mints a JWT that expires in minutes — a CLI that
|
|
177
|
+
* re-authenticates every quarter of an hour is not a CLI anybody uses. With
|
|
178
|
+
* it, approval issues a personal access token that is long-lived AND revocable
|
|
179
|
+
* from the web UI's Access Tokens page, which is the property that makes a
|
|
180
|
+
* long-lived credential acceptable in the first place.
|
|
181
|
+
*
|
|
182
|
+
* The endpoint is `@Public()`, so no token is sent — correct, since acquiring
|
|
183
|
+
* one is the point.
|
|
184
|
+
*/
|
|
185
|
+
export async function requestDeviceCode(client, options) {
|
|
186
|
+
const grant = await client.post('/auth/device/code', {
|
|
187
|
+
clientInfo: {
|
|
188
|
+
deviceName: options.deviceName,
|
|
189
|
+
...(options.userAgent === undefined ? {} : { userAgent: options.userAgent }),
|
|
190
|
+
tokenType: 'pat',
|
|
191
|
+
},
|
|
192
|
+
}, options.signal === undefined ? undefined : { signal: options.signal });
|
|
193
|
+
if (grant === null ||
|
|
194
|
+
typeof grant !== 'object' ||
|
|
195
|
+
typeof grant.deviceCode !== 'string' ||
|
|
196
|
+
typeof grant.userCode !== 'string') {
|
|
197
|
+
// A 2xx with the wrong shape means we are not talking to this API — a
|
|
198
|
+
// captive portal, a stale reverse proxy, the wrong host. Saying so beats
|
|
199
|
+
// the alternative, which is polling forever with `deviceCode: undefined`.
|
|
200
|
+
throw new DeviceLoginError('unclassified', 'The server accepted the device-code request but did not return a device code. Check that the server URL points at this application.');
|
|
201
|
+
}
|
|
202
|
+
return grant;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Poll until the device is approved, or until one of the terminal outcomes.
|
|
206
|
+
*
|
|
207
|
+
* Returns the credential. Throws DeviceLoginError for a protocol outcome, or
|
|
208
|
+
* lets NetworkError through untouched — a connection that dropped mid-wait is
|
|
209
|
+
* a different problem from a refusal, and flattening the two is exactly what
|
|
210
|
+
* #142 forbids.
|
|
211
|
+
*/
|
|
212
|
+
export async function pollForDeviceToken(options) {
|
|
213
|
+
const sleep = options.sleep ?? defaultSleep;
|
|
214
|
+
const now = options.now ?? Date.now;
|
|
215
|
+
const onState = options.onState;
|
|
216
|
+
// Clamped rather than trusted. A server that advertises `interval: 0` (a
|
|
217
|
+
// misconfigured DEVICE_CODE_POLL_INTERVAL, an integer parsed from an empty
|
|
218
|
+
// env var) would otherwise produce a tight loop that hammers a public
|
|
219
|
+
// endpoint as fast as the event loop allows — a self-inflicted denial of
|
|
220
|
+
// service that also guarantees a `slow_down` on every request.
|
|
221
|
+
let intervalSeconds = clampInterval(options.intervalSeconds);
|
|
222
|
+
// The LOCAL deadline, taken from the server's own `expiresIn`. It exists
|
|
223
|
+
// because the authoritative expiry signal (`expired_token`) may never
|
|
224
|
+
// arrive: the connection can be gone, or — today — the code can be
|
|
225
|
+
// unrecoverable from the response body. Without it the loop is unbounded,
|
|
226
|
+
// and an unbounded wait in CI burns the whole job budget.
|
|
227
|
+
const deadline = now() + options.expiresInSeconds * 1000;
|
|
228
|
+
let attempt = 0;
|
|
229
|
+
let warnedUnclassified = false;
|
|
230
|
+
for (;;) {
|
|
231
|
+
throwIfCancelled(options.signal);
|
|
232
|
+
if (now() >= deadline) {
|
|
233
|
+
throw expiredError();
|
|
234
|
+
}
|
|
235
|
+
attempt += 1;
|
|
236
|
+
onState?.({
|
|
237
|
+
kind: 'polling',
|
|
238
|
+
attempt,
|
|
239
|
+
intervalSeconds,
|
|
240
|
+
secondsRemaining: Math.max(0, Math.ceil((deadline - now()) / 1000)),
|
|
241
|
+
});
|
|
242
|
+
const signal = await pollOnce(options.client, options.deviceCode, options.signal);
|
|
243
|
+
switch (signal.kind) {
|
|
244
|
+
case 'approved':
|
|
245
|
+
onState?.({ kind: 'approved' });
|
|
246
|
+
return signal.credential;
|
|
247
|
+
case 'pending':
|
|
248
|
+
break;
|
|
249
|
+
case 'slow_down':
|
|
250
|
+
// The RFC's remedy, applied before the sleep so the widened interval
|
|
251
|
+
// takes effect immediately. Note we do NOT also retry sooner or reset
|
|
252
|
+
// the attempt counter: the server asked for less traffic, and the only
|
|
253
|
+
// correct response is less traffic.
|
|
254
|
+
intervalSeconds = clampInterval(intervalSeconds + SLOW_DOWN_INCREMENT_SECONDS);
|
|
255
|
+
onState?.({ kind: 'slow_down', intervalSeconds });
|
|
256
|
+
break;
|
|
257
|
+
case 'denied':
|
|
258
|
+
throw new DeviceLoginError('denied', `Authorization was denied in the browser. Nothing was saved. Run \`${cliName()} login\` again if that was not what you intended.`);
|
|
259
|
+
case 'expired':
|
|
260
|
+
throw expiredError();
|
|
261
|
+
case 'invalid_grant':
|
|
262
|
+
throw new DeviceLoginError('invalid_grant', `The server rejected this device code (${signal.message}). It may already have been used. Run \`${cliName()} login\` to start again.`);
|
|
263
|
+
case 'unclassified': {
|
|
264
|
+
if (UNCLASSIFIED_POLL_POLICY === 'fatal') {
|
|
265
|
+
throw new DeviceLoginError('unclassified', `The server returned ${signal.status} without a recognisable device-authorization status (${signal.message}).`);
|
|
266
|
+
}
|
|
267
|
+
// Warn ONCE. Repeating it every interval would bury the user code and
|
|
268
|
+
// the verification URL — the two things they still need to read — under
|
|
269
|
+
// a scrolling wall of the same sentence.
|
|
270
|
+
if (!warnedUnclassified) {
|
|
271
|
+
warnedUnclassified = true;
|
|
272
|
+
options.onUnclassified?.(signal);
|
|
273
|
+
}
|
|
274
|
+
break;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
// Bounded by the deadline so the last sleep cannot overrun it by an
|
|
278
|
+
// interval and turn a live code into an expired one while we wait.
|
|
279
|
+
const remaining = deadline - now();
|
|
280
|
+
if (remaining <= 0)
|
|
281
|
+
throw expiredError();
|
|
282
|
+
await sleep(Math.min(intervalSeconds * 1000 + POLL_MARGIN_MS, remaining), options.signal);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* One poll. Every response — success or failure — becomes a DevicePollSignal;
|
|
287
|
+
* only a NetworkError escapes, and it escapes on purpose.
|
|
288
|
+
*/
|
|
289
|
+
export async function pollOnce(client, deviceCode, signal) {
|
|
290
|
+
try {
|
|
291
|
+
const body = await client.post('/auth/device/token', { deviceCode }, signal === undefined ? undefined : { signal });
|
|
292
|
+
if (body === null || typeof body !== 'object' || typeof body.accessToken !== 'string') {
|
|
293
|
+
return {
|
|
294
|
+
kind: 'unclassified',
|
|
295
|
+
status: 200,
|
|
296
|
+
message: 'the server reported success but returned no access token',
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
return { kind: 'approved', credential: body };
|
|
300
|
+
}
|
|
301
|
+
catch (error) {
|
|
302
|
+
// NOT caught: NetworkError. It propagates so the caller can say "the
|
|
303
|
+
// connection dropped" rather than inventing a protocol outcome for it —
|
|
304
|
+
// the fifth distinct case in the list at the top of this file.
|
|
305
|
+
if (!(error instanceof ApiError))
|
|
306
|
+
throw error;
|
|
307
|
+
return classifyPollFailure(error);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Map a failed poll response to an RFC 8628 outcome.
|
|
312
|
+
*
|
|
313
|
+
* Exported because it is the piece worth testing exhaustively, and pure so it
|
|
314
|
+
* can be: no clock, no client, no I/O.
|
|
315
|
+
*
|
|
316
|
+
* FOUR SOURCES ARE CHECKED, in decreasing order of authority, because the code
|
|
317
|
+
* can survive in different places depending on how the server is built:
|
|
318
|
+
*
|
|
319
|
+
* 1. `error` in the raw body — the RFC-correct location, and where this API
|
|
320
|
+
* puts it before its exception filter drops it (see the block at the top
|
|
321
|
+
* of this file). Checked first so the classifier is already correct on the
|
|
322
|
+
* day the API is fixed, with no further change here.
|
|
323
|
+
* 2. `error_description` in the raw body — same object, some frameworks emit
|
|
324
|
+
* only the description.
|
|
325
|
+
* 3. `code` in the parsed envelope — where a fix might reasonably land,
|
|
326
|
+
* since that field already survives the filter.
|
|
327
|
+
* 4. The server's message text — last resort, and matched as a WHOLE WORD.
|
|
328
|
+
* A substring match would be actively dangerous here: `access_denied`
|
|
329
|
+
* contains neither of the others, but a generic sentence mentioning
|
|
330
|
+
* "authorization pending, or denied" must not be read as a denial.
|
|
331
|
+
*
|
|
332
|
+
* Anything else is `unclassified` and is NOT guessed at. Guessing "probably
|
|
333
|
+
* pending" inside the classifier would hide the ambiguity from the caller and
|
|
334
|
+
* from its tests; the caller decides what to do with an unknown, in one
|
|
335
|
+
* documented place.
|
|
336
|
+
*/
|
|
337
|
+
export function classifyPollFailure(error) {
|
|
338
|
+
const found = codeFromRawBody(error.rawBody) ??
|
|
339
|
+
matchErrorCode(error.code) ??
|
|
340
|
+
matchErrorCodeInText(error.serverMessage);
|
|
341
|
+
switch (found) {
|
|
342
|
+
case 'authorization_pending':
|
|
343
|
+
return { kind: 'pending' };
|
|
344
|
+
case 'slow_down':
|
|
345
|
+
return { kind: 'slow_down' };
|
|
346
|
+
case 'expired_token':
|
|
347
|
+
return { kind: 'expired' };
|
|
348
|
+
case 'access_denied':
|
|
349
|
+
return { kind: 'denied' };
|
|
350
|
+
case 'invalid_grant':
|
|
351
|
+
return { kind: 'invalid_grant', message: error.serverMessage };
|
|
352
|
+
default:
|
|
353
|
+
return { kind: 'unclassified', status: error.status, message: error.serverMessage };
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
// -----------------------------------------------------------------------------
|
|
357
|
+
// Helpers
|
|
358
|
+
// -----------------------------------------------------------------------------
|
|
359
|
+
/** Read `error` / `error_description` straight out of the untouched body. */
|
|
360
|
+
function codeFromRawBody(rawBody) {
|
|
361
|
+
if (rawBody === undefined || rawBody.trim().length === 0)
|
|
362
|
+
return undefined;
|
|
363
|
+
let parsed;
|
|
364
|
+
try {
|
|
365
|
+
parsed = JSON.parse(rawBody);
|
|
366
|
+
}
|
|
367
|
+
catch {
|
|
368
|
+
// An HTML proxy page. Not our protocol; leave it to the caller's fallback.
|
|
369
|
+
return undefined;
|
|
370
|
+
}
|
|
371
|
+
if (parsed === null || typeof parsed !== 'object' || Array.isArray(parsed))
|
|
372
|
+
return undefined;
|
|
373
|
+
const body = parsed;
|
|
374
|
+
return (matchErrorCode(body.error) ??
|
|
375
|
+
matchErrorCode(body.error_description) ??
|
|
376
|
+
matchErrorCodeInText(body.error_description));
|
|
377
|
+
}
|
|
378
|
+
/** Exact match against the known codes. */
|
|
379
|
+
function matchErrorCode(value) {
|
|
380
|
+
if (typeof value !== 'string')
|
|
381
|
+
return undefined;
|
|
382
|
+
const normalised = value.trim().toLowerCase();
|
|
383
|
+
return DEVICE_POLL_ERROR_CODES.includes(normalised)
|
|
384
|
+
? normalised
|
|
385
|
+
: undefined;
|
|
386
|
+
}
|
|
387
|
+
/**
|
|
388
|
+
* Whole-word search for a code inside a sentence.
|
|
389
|
+
*
|
|
390
|
+
* `\b` on both sides, so `expired_token_handler` is not read as
|
|
391
|
+
* `expired_token`. At most ONE code may match: a message mentioning two is
|
|
392
|
+
* ambiguous, and picking the first would be an arbitrary choice between
|
|
393
|
+
* outcomes that have opposite consequences (keep waiting vs. stop and tell the
|
|
394
|
+
* user they were denied). Ambiguous returns undefined and the caller reports
|
|
395
|
+
* an unclassified response, which is the truth.
|
|
396
|
+
*/
|
|
397
|
+
function matchErrorCodeInText(value) {
|
|
398
|
+
if (typeof value !== 'string')
|
|
399
|
+
return undefined;
|
|
400
|
+
const text = value.toLowerCase();
|
|
401
|
+
const hits = DEVICE_POLL_ERROR_CODES.filter((code) => new RegExp(`\\b${code}\\b`).test(text));
|
|
402
|
+
return hits.length === 1 ? hits[0] : undefined;
|
|
403
|
+
}
|
|
404
|
+
function clampInterval(seconds) {
|
|
405
|
+
if (!Number.isFinite(seconds) || seconds <= 0)
|
|
406
|
+
return 1;
|
|
407
|
+
return Math.min(Math.ceil(seconds), MAX_POLL_INTERVAL_SECONDS);
|
|
408
|
+
}
|
|
409
|
+
function expiredError() {
|
|
410
|
+
return new DeviceLoginError('expired', `The device code expired before it was approved. Run \`${cliName()} login\` to get a new code.`);
|
|
411
|
+
}
|
|
412
|
+
function throwIfCancelled(signal) {
|
|
413
|
+
if (signal?.aborted === true) {
|
|
414
|
+
throw new DeviceLoginError('cancelled', 'Login cancelled.');
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
/**
|
|
418
|
+
* Sleep that a cancellation can interrupt.
|
|
419
|
+
*
|
|
420
|
+
* The listener is removed in every exit path. A poll loop that runs for the
|
|
421
|
+
* full 15-minute code lifetime adds a listener per interval, and AbortSignal
|
|
422
|
+
* warns (then leaks) past ten — so an un-removed listener here is a real leak
|
|
423
|
+
* on the one path that runs longest, not a theoretical one.
|
|
424
|
+
*/
|
|
425
|
+
function defaultSleep(ms, signal) {
|
|
426
|
+
return new Promise((resolve, reject) => {
|
|
427
|
+
if (signal?.aborted === true) {
|
|
428
|
+
reject(new DeviceLoginError('cancelled', 'Login cancelled.'));
|
|
429
|
+
return;
|
|
430
|
+
}
|
|
431
|
+
const onAbort = () => {
|
|
432
|
+
clearTimeout(timer);
|
|
433
|
+
reject(new DeviceLoginError('cancelled', 'Login cancelled.'));
|
|
434
|
+
};
|
|
435
|
+
const timer = setTimeout(() => {
|
|
436
|
+
signal?.removeEventListener('abort', onAbort);
|
|
437
|
+
resolve();
|
|
438
|
+
}, ms);
|
|
439
|
+
signal?.addEventListener('abort', onAbort, { once: true });
|
|
440
|
+
});
|
|
441
|
+
}
|
|
442
|
+
//# sourceMappingURL=device-auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"device-auth.js","sourceRoot":"","sources":["../../src/engine/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126 @@
|
|
|
1
|
+
import { ApiClient } from './api-client.js';
|
|
2
|
+
import { type BrowserOpenResult } from './browser.js';
|
|
3
|
+
import { type ConfigContext } from './config.js';
|
|
4
|
+
import { DeviceLoginError, type DeviceCodeGrant, type DeviceCredential, type DevicePollSignal, type DevicePollState } from './device-auth.js';
|
|
5
|
+
/** `GET /api/auth/me`, matching CurrentUserDto. Enough to confirm and greet. */
|
|
6
|
+
export interface CurrentUser {
|
|
7
|
+
id: string;
|
|
8
|
+
email: string;
|
|
9
|
+
displayName: string | null;
|
|
10
|
+
isActive: boolean;
|
|
11
|
+
roles: Array<{
|
|
12
|
+
name: string;
|
|
13
|
+
}>;
|
|
14
|
+
permissions: string[];
|
|
15
|
+
}
|
|
16
|
+
/** Everything a UI needs, pushed rather than printed. All optional. */
|
|
17
|
+
export interface DeviceLoginHooks {
|
|
18
|
+
/** The code pair arrived. Show `userCode` and `verificationUriComplete` NOW. */
|
|
19
|
+
onCodeIssued?: ((grant: DeviceCodeGrant) => void) | undefined;
|
|
20
|
+
/** The browser was, or was not, opened. Never a failure. */
|
|
21
|
+
onBrowserOpen?: ((result: BrowserOpenResult & {
|
|
22
|
+
url: string;
|
|
23
|
+
}) => void) | undefined;
|
|
24
|
+
/** Live polling state, for a spinner or a status line. */
|
|
25
|
+
onPollState?: ((state: DevicePollState) => void) | undefined;
|
|
26
|
+
/** Fired once if the server's poll responses could not be classified. */
|
|
27
|
+
onUnclassified?: ((signal: Extract<DevicePollSignal, {
|
|
28
|
+
kind: 'unclassified';
|
|
29
|
+
}>) => void) | undefined;
|
|
30
|
+
}
|
|
31
|
+
export interface DeviceLoginOptions {
|
|
32
|
+
/** What the user typed — `app.example.com`, not the `/api` root. */
|
|
33
|
+
serverUrl: string;
|
|
34
|
+
/** Shown on the activation page and used to name the PAT. */
|
|
35
|
+
deviceName?: string | undefined;
|
|
36
|
+
hooks?: DeviceLoginHooks | undefined;
|
|
37
|
+
signal?: AbortSignal | undefined;
|
|
38
|
+
/** Skip the browser launch (a `--no-browser` flag, or a TUI that opens it). */
|
|
39
|
+
openBrowser?: boolean | undefined;
|
|
40
|
+
/** Test seam, forwarded to the poll loop. */
|
|
41
|
+
sleep?: ((ms: number, signal?: AbortSignal | undefined) => Promise<void>) | undefined;
|
|
42
|
+
/** Test seam: build the client rather than constructing the real one. */
|
|
43
|
+
createClient?: ((apiBaseUrl: string) => ApiClient) | undefined;
|
|
44
|
+
}
|
|
45
|
+
export interface DeviceLoginResult {
|
|
46
|
+
grant: DeviceCodeGrant;
|
|
47
|
+
credential: DeviceCredential;
|
|
48
|
+
/** The `/api` root the credential is good against. */
|
|
49
|
+
apiBaseUrl: string;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Run the device flow and return the issued credential. Does NOT save.
|
|
53
|
+
*
|
|
54
|
+
* Saving is separate because the two entry points (`login` and
|
|
55
|
+
* `login --token`) converge only at `completeLogin`, and because a caller that wants
|
|
56
|
+
* the credential without touching the user's config — a test, a future
|
|
57
|
+
* `--print-token`-free integration — should not have to opt out of a side
|
|
58
|
+
* effect.
|
|
59
|
+
*/
|
|
60
|
+
export declare function runDeviceLogin(options: DeviceLoginOptions): Promise<DeviceLoginResult>;
|
|
61
|
+
/**
|
|
62
|
+
* Validate a token against `GET /api/auth/me`.
|
|
63
|
+
*
|
|
64
|
+
* WHY VALIDATE AT ALL when the device flow just minted the token: because the
|
|
65
|
+
* headless `--token` path did not, and both paths must fail in the same place
|
|
66
|
+
* for the same reason. A pasted token that is mistyped, expired, revoked, or
|
|
67
|
+
* from a different server is the common case there, and the difference between
|
|
68
|
+
* catching it here and not catching it is the difference between "that token
|
|
69
|
+
* is not valid on this server" at login and a mystifying 401 from an unrelated
|
|
70
|
+
* command three days later — by which time nobody remembers what was pasted.
|
|
71
|
+
*
|
|
72
|
+
* It is also the only check that the account is USABLE. `JwtAuthGuard` rejects
|
|
73
|
+
* a disabled user, so a token belonging to a deactivated account fails here
|
|
74
|
+
* rather than after being written to disk as if it worked.
|
|
75
|
+
*/
|
|
76
|
+
export declare function validateToken(serverUrl: string, token: string, options?: {
|
|
77
|
+
signal?: AbortSignal | undefined;
|
|
78
|
+
createClient?: ((apiBaseUrl: string, token: string) => ApiClient) | undefined;
|
|
79
|
+
}): Promise<CurrentUser>;
|
|
80
|
+
export interface CompleteLoginInput {
|
|
81
|
+
serverUrl: string;
|
|
82
|
+
token: string;
|
|
83
|
+
expiresAt?: string | undefined;
|
|
84
|
+
tokenId?: string | undefined;
|
|
85
|
+
tokenName?: string | undefined;
|
|
86
|
+
signal?: AbortSignal | undefined;
|
|
87
|
+
configContext?: ConfigContext | undefined;
|
|
88
|
+
createClient?: ((apiBaseUrl: string, token: string) => ApiClient) | undefined;
|
|
89
|
+
}
|
|
90
|
+
export interface CompleteLoginResult {
|
|
91
|
+
user: CurrentUser;
|
|
92
|
+
/** Where the config was written. Safe to print; contains no secret. */
|
|
93
|
+
path: string;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Validate, THEN save. The final step of both login paths.
|
|
97
|
+
*
|
|
98
|
+
* THE ORDER IS THE POINT. Saving first and validating afterwards leaves a
|
|
99
|
+
* token that does not work sitting in the config on every failure, and the
|
|
100
|
+
* next command reports a 401 that looks like a revoked credential rather than
|
|
101
|
+
* a login that never succeeded. Validating first means a failed login changes
|
|
102
|
+
* nothing on disk — the previous, working credential survives an attempt to
|
|
103
|
+
* replace it with a bad one, which is the behaviour a user assumes and would
|
|
104
|
+
* not think to check.
|
|
105
|
+
*/
|
|
106
|
+
export declare function completeLogin(input: CompleteLoginInput): Promise<CompleteLoginResult>;
|
|
107
|
+
/**
|
|
108
|
+
* A name the user will recognise in the Access Tokens page.
|
|
109
|
+
*
|
|
110
|
+
* `user@host` is the string that answers the only question that page asks —
|
|
111
|
+
* "which machine is this, and should it still have access?" — and it is what
|
|
112
|
+
* makes revocation possible in practice. A generic "CLI" on four rows tells
|
|
113
|
+
* nobody which laptop was lost.
|
|
114
|
+
*
|
|
115
|
+
* `userInfo()` throws when the uid has no passwd entry, which happens in
|
|
116
|
+
* containers running as an arbitrary uid — a routine setup, not an exotic one
|
|
117
|
+
* — so both halves degrade rather than taking the login down over a label.
|
|
118
|
+
* The server sanitises this before it becomes a token name
|
|
119
|
+
* (`DeviceAuthService.buildPatName`), which matters because it is
|
|
120
|
+
* attacker-supplied from the API's point of view.
|
|
121
|
+
*/
|
|
122
|
+
export declare function defaultDeviceName(): string;
|
|
123
|
+
/** Re-exported so a consumer needs one import for the whole flow. */
|
|
124
|
+
export { DeviceLoginError };
|
|
125
|
+
export type { DeviceCodeGrant, DeviceCredential, DevicePollState };
|
|
126
|
+
//# sourceMappingURL=device-login.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"device-login.d.ts","sourceRoot":"","sources":["../../src/engine/device-login.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAqB,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EAAiB,KAAK,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAErE,OAAO,EAAmB,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,EACL,gBAAgB,EAGhB,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACrB,MAAM,kBAAkB,CAAC;AA0B1B,gFAAgF;AAChF,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC/B,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB;AAED,uEAAuE;AACvE,MAAM,WAAW,gBAAgB;IAC/B,gFAAgF;IAChF,YAAY,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,eA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