@devicecloud.dev/dcd 5.12.0 → 5.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,6 +11,12 @@
11
11
  export type DcdEnvName = 'dev' | 'prod';
12
12
  export interface DcdEnvironment {
13
13
  apiUrl: string;
14
+ /**
15
+ * Older API URLs that still reach this environment. A config saved by an
16
+ * earlier `dcd login`, or a `--api-url` in someone's CI, may still name one,
17
+ * so it must keep resolving to this environment.
18
+ */
19
+ legacyApiUrls?: string[];
14
20
  frontendUrl: string;
15
21
  supabase: {
16
22
  url: string;
@@ -18,9 +24,17 @@ export interface DcdEnvironment {
18
24
  };
19
25
  }
20
26
  export declare const ENVIRONMENTS: Record<DcdEnvName, DcdEnvironment>;
21
- /** Exact-match lookup of a known environment by API URL (trailing slashes ignored). */
27
+ /**
28
+ * Exact-match lookup of a known environment by API URL, current or legacy
29
+ * (trailing slashes ignored).
30
+ */
22
31
  export declare function findEnvByApiUrl(apiUrl: string): DcdEnvironment | undefined;
23
- /** Map a caller-supplied API URL to one of the known environments. */
32
+ /**
33
+ * Map a caller-supplied API URL to one of the known environments. This picks
34
+ * the Supabase project uploads go to, so a dev URL must never fall through to
35
+ * prod: both dev hostnames (`dev-api.` and the older `api.dev.`) and
36
+ * localhost are dev.
37
+ */
24
38
  export declare function inferEnvFromApiUrl(apiUrl: string): DcdEnvName;
25
39
  /**
26
40
  * Frontend URL to open for a given API URL. Same as
@@ -18,7 +18,8 @@ export const ENVIRONMENTS = {
18
18
  },
19
19
  },
20
20
  dev: {
21
- apiUrl: 'https://api.dev.devicecloud.dev',
21
+ apiUrl: 'https://dev-api.devicecloud.dev',
22
+ legacyApiUrls: ['https://api.dev.devicecloud.dev'],
22
23
  frontendUrl: 'https://dev.console.devicecloud.dev',
23
24
  supabase: {
24
25
  url: 'https://lbmsowehtjwnqlurpemb.supabase.co',
@@ -26,16 +27,27 @@ export const ENVIRONMENTS = {
26
27
  },
27
28
  },
28
29
  };
29
- /** Exact-match lookup of a known environment by API URL (trailing slashes ignored). */
30
+ /**
31
+ * Exact-match lookup of a known environment by API URL, current or legacy
32
+ * (trailing slashes ignored).
33
+ */
30
34
  export function findEnvByApiUrl(apiUrl) {
31
35
  const normalize = (u) => u.replace(/\/+$/, '');
32
36
  const needle = normalize(apiUrl);
33
- return Object.values(ENVIRONMENTS).find((env) => normalize(env.apiUrl) === needle);
37
+ return Object.values(ENVIRONMENTS).find((env) => [env.apiUrl, ...(env.legacyApiUrls ?? [])].some((u) => normalize(u) === needle));
34
38
  }
35
- /** Map a caller-supplied API URL to one of the known environments. */
39
+ /**
40
+ * Map a caller-supplied API URL to one of the known environments. This picks
41
+ * the Supabase project uploads go to, so a dev URL must never fall through to
42
+ * prod: both dev hostnames (`dev-api.` and the older `api.dev.`) and
43
+ * localhost are dev.
44
+ */
36
45
  export function inferEnvFromApiUrl(apiUrl) {
37
- if (apiUrl.includes('api.dev.') || apiUrl.includes('localhost'))
46
+ if (apiUrl.includes('dev-api.') ||
47
+ apiUrl.includes('api.dev.') ||
48
+ apiUrl.includes('localhost')) {
38
49
  return 'dev';
50
+ }
39
51
  return 'prod';
40
52
  }
41
53
  /**
package/package.json CHANGED
@@ -68,7 +68,7 @@
68
68
  "test:unit": "node scripts/test-runner.mjs --unit",
69
69
  "typecheck": "tsc --noEmit -p tsconfig.test.json"
70
70
  },
71
- "version": "5.12.0",
71
+ "version": "5.12.1",
72
72
  "bugs": {
73
73
  "url": "https://discord.gg/gm3mJwcNw8"
74
74
  },
@@ -111,7 +111,7 @@
111
111
  "esbuild@<0.28.1": ">=0.28.1",
112
112
  "qs@<6.16.1": "6.16.1",
113
113
  "fast-uri@>=3.0.0 <3.1.9": "3.1.9",
114
- "hono@>=4.0.0 <4.13.11": "4.13.11",
114
+ "hono@>=4.0.0 <4.13.16": "4.13.16",
115
115
  "source-map-js@<1.2.2": "1.2.2",
116
116
  "micromatch>picomatch": "^2.3.2",
117
117
  "tinyglobby>picomatch": "^4.0.4"