ninepm 0.60.0 → 0.61.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.60.0";
119
+ export declare const CLI_VERSION = "0.61.0";
120
120
  type CredentialBackend = "macos-keychain" | "windows-dpapi" | "linux-secret-service" | "file-plaintext" | "none";
121
121
  export interface StoredCredentialEntry {
122
122
  token: string;
@@ -396,6 +396,7 @@ export interface DeviceAuthProgressReporter {
396
396
  export declare function createDeviceAuthProgressReporter(stream?: NodeJS.WriteStream): DeviceAuthProgressReporter;
397
397
  export declare function noteCliOutdatedAdvisory(response: Response, log?: (line: string) => void): void;
398
398
  export declare function resetCliOutdatedAdvisoryForTests(): void;
399
+ export declare function dashboardUrlForApiUrl(apiUrl: string): string;
399
400
  type CliCommand = {
400
401
  kind: "deploy";
401
402
  options: DeployOptions;
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.60.0";
18
+ export const CLI_VERSION = "0.61.0";
19
19
  const PUBLIC_DASHBOARD_URL = "https://9pm.ai/dashboard";
20
20
  const TOKEN_SERVICE = "9pm";
21
21
  const TOKEN_ACCOUNT = "default";
@@ -2178,6 +2178,22 @@ function withFetchDiagnostics(fetchFn) {
2178
2178
  function normalizeApiUrl(value) {
2179
2179
  return value.replace(/\/+$/g, "");
2180
2180
  }
2181
+ // The dashboard that manages what this CLI just deployed lives on the same
2182
+ // control plane as the API it talked to: api-<env>.9pm.ai is served beside
2183
+ // <env>.9pm.ai, and api.9pm.ai beside the public site. An origin outside that
2184
+ // shape (local dev, an unparseable URL) names production, the only dashboard a
2185
+ // tester could hold an account on.
2186
+ export function dashboardUrlForApiUrl(apiUrl) {
2187
+ let host;
2188
+ try {
2189
+ host = new URL(normalizeApiUrl(apiUrl)).hostname.toLowerCase();
2190
+ }
2191
+ catch {
2192
+ return PUBLIC_DASHBOARD_URL;
2193
+ }
2194
+ const environment = /^api-([a-z0-9-]+)\.9pm\.ai$/.exec(host);
2195
+ return environment ? `https://${environment[1]}.9pm.ai/dashboard` : PUBLIC_DASHBOARD_URL;
2196
+ }
2181
2197
  function pathFromUpload(upload, deploymentId) {
2182
2198
  const marker = `/v1/uploads/${encodeURIComponent(deploymentId)}/`;
2183
2199
  const index = upload.path.indexOf(marker);
@@ -4026,7 +4042,7 @@ async function main() {
4026
4042
  if (queued) {
4027
4043
  console.log(`Status: ${result.deployment.status}. Run 9pm apps to check when it becomes active.`);
4028
4044
  }
4029
- console.log(`Manage: ${PUBLIC_DASHBOARD_URL}${command.options.owner ? `?owner=${encodeURIComponent(command.options.owner)}` : ""}`);
4045
+ console.log(`Manage: ${dashboardUrlForApiUrl(command.options.apiUrl)}${command.options.owner ? `?owner=${encodeURIComponent(command.options.owner)}` : ""}`);
4030
4046
  // Gated the same way as the reachability probe above: a programmatic
4031
4047
  // caller injecting fetchFn opted out of the CLI's own network side trips.
4032
4048
  if (!command.options.fetchFn) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ninepm",
3
- "version": "0.60.0",
3
+ "version": "0.61.0",
4
4
  "description": "CLI for deploying built apps to 9pm.ai.",
5
5
  "homepage": "https://9pm.ai",
6
6
  "keywords": [