ninepm 0.58.0 → 0.59.0

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/dist/index.d.ts CHANGED
@@ -116,7 +116,7 @@ export interface CreatedServiceToken {
116
116
  clientSecret: string;
117
117
  }
118
118
  export type FetchLike = (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
119
- export declare const CLI_VERSION = "0.58.0";
119
+ export declare const CLI_VERSION = "0.59.0";
120
120
  type CredentialBackend = "macos-keychain" | "windows-dpapi" | "linux-secret-service" | "file-plaintext" | "none";
121
121
  export interface StoredCredentialEntry {
122
122
  token: string;
package/dist/index.js CHANGED
@@ -15,7 +15,7 @@ import { managedHostnamesIn, siblingCallWarning, siblingsOf } from "./sibling-ho
15
15
  import { MAX_STATIC_ASSET_FILE_BYTES, MAX_WORKER_ENTRY_COMPRESSED_BYTES, MAX_WORKER_SCRIPT_COMPRESSED_BYTES, WORKER_ENTRY_COMPRESSED_WARN_BYTES, assetFileTooLargeMessage, formatMebibytes, formatMegabytes, oversizedAssets, workerBundleNearLimitMessage, workerBundleTooLargeMessage, workerEntryNearLimitMessage, workerEntryTooLargeMessage, } from "./deploy-limits.js";
16
16
  import { buildFileManifest, readManifestFile } from "./manifest.js";
17
17
  import { API_KEY_HELP, API_URL_HELP, CLI_CLIENT_ID, DEFAULT_API_URL, reportCliError } from "./cli-config.js";
18
- export const CLI_VERSION = "0.58.0";
18
+ export const CLI_VERSION = "0.59.0";
19
19
  const PUBLIC_DASHBOARD_URL = "https://9pm.ai/dashboard";
20
20
  const TOKEN_SERVICE = "9pm";
21
21
  const TOKEN_ACCOUNT = "default";
@@ -903,15 +903,21 @@ function revocationFailureReason(error) {
903
903
  }
904
904
  return error instanceof Error ? error.message : String(error);
905
905
  }
906
- // The ONLY refusal that proves anything about the stored credential:
907
- // requireAuth emits invalid_api_key after looking the presented token up
908
- // (src/server/routes/guards.ts). Its siblings do not — missing_api_key means no
909
- // credential arrived at all and malformed_api_key means the header was not a
910
- // bearer token, both of which a proxy that strips or rewrites Authorization
911
- // produces for a perfectly live key. Anything else answering 401/403 is an
912
- // intermediary rather than the control plane judging this credential.
906
+ // The refusals that prove something about the stored credential: requireAuth emits
907
+ // both AFTER looking the presented token up (src/server/routes/guards.ts), so each
908
+ // is the control plane judging this credential. Their siblings do not — missing_api_key
909
+ // means no credential arrived at all and malformed_api_key means the header was not a
910
+ // bearer token, both of which a proxy that strips or rewrites Authorization produces
911
+ // for a perfectly live key. Anything else answering 401/403 is an intermediary rather
912
+ // than the control plane judging this credential.
913
+ //
914
+ // A set rather than a comparison because the list is now open: a key refused for
915
+ // inactivity (#854) is as dead to its holder as a revoked one, and a refusal this
916
+ // function does not recognise turns a clean `9pm logout` into a reported failure
917
+ // blaming an intermediary that was never involved.
918
+ const CREDENTIAL_REFUSAL_CODES = new Set(["invalid_api_key", "expired_api_key"]);
913
919
  async function isAuthRefusal(response) {
914
- return (await responseErrorCode(response)) === "invalid_api_key";
920
+ return CREDENTIAL_REFUSAL_CODES.has(await responseErrorCode(response));
915
921
  }
916
922
  // The `code` from the control plane's {error:{code}} envelope, or "" when the
917
923
  // body is not that shape (proxy error page, empty body).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ninepm",
3
- "version": "0.58.0",
3
+ "version": "0.59.0",
4
4
  "description": "CLI for deploying built apps to 9pm.ai.",
5
5
  "homepage": "https://9pm.ai",
6
6
  "keywords": [