deepspace 0.34.0 → 0.36.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/cli.js CHANGED
@@ -676,27 +676,62 @@ function findUnknownCommand(argv, rootCommands) {
676
676
  return null;
677
677
  }
678
678
 
679
+ // src/shared/planes.ts
680
+ var PLANES = {
681
+ production: {
682
+ auth: "https://auth.deep.space",
683
+ api: "https://api-worker.deep.space",
684
+ platform: "https://platform-worker.deep.space",
685
+ deploy: "https://deploy-worker.deep.space",
686
+ appDomain: "app.space",
687
+ platformDomain: "deep.space",
688
+ home: "https://deep.space",
689
+ dashboard: "https://dashboard.deep.space",
690
+ privacyPolicy: "https://deep.space/privacy"
691
+ },
692
+ // Services on deepspacesites.com, apps on spacestest.com: production's
693
+ // two-zone split, because a Worker cannot fetch one in its own zone.
694
+ staging: {
695
+ auth: "https://auth.deepspacesites.com",
696
+ api: "https://api.deepspacesites.com",
697
+ platform: "https://platform.deepspacesites.com",
698
+ deploy: "https://deploy.deepspacesites.com",
699
+ appDomain: "spacestest.com",
700
+ platformDomain: "deepspacesites.com",
701
+ home: "https://spacestest.com",
702
+ dashboard: "https://dashboard.deepspacesites.com",
703
+ privacyPolicy: "https://deep.space/privacy"
704
+ },
705
+ // Services on deepspacemedical.com, apps on deepspacemedical.app: two zones
706
+ // in the medical Cloudflare account. The plane has no dashboard.
707
+ medical: {
708
+ auth: "https://auth.deepspacemedical.com",
709
+ api: "https://api.deepspacemedical.com",
710
+ platform: "https://platform.deepspacemedical.com",
711
+ deploy: "https://deploy.deepspacemedical.com",
712
+ appDomain: "deepspacemedical.app",
713
+ platformDomain: "deepspacemedical.com",
714
+ home: "https://deepspacemedical.com",
715
+ dashboard: null,
716
+ privacyPolicy: "https://deepspacemedical.com/privacy"
717
+ }
718
+ };
719
+
679
720
  // src/cli/env.ts
680
721
  function resolveDeepSpaceEnvironment(value) {
681
722
  if (value === void 0 || value === "production") return "production";
682
723
  if (value === "staging") return "staging";
724
+ if (value === "medical") return "medical";
683
725
  return "invalid";
684
726
  }
685
727
  var DEEPSPACE_ENV = resolveDeepSpaceEnvironment(process.env.DEEPSPACE_ENV);
686
- var PROD_URLS = {
687
- auth: "https://auth.deep.space",
688
- api: "https://api-worker.deep.space",
689
- platform: "https://platform-worker.deep.space",
690
- deploy: "https://deploy-worker.deep.space"
691
- };
692
- var STAGING_URLS = {
693
- // Services live on deepspacesites.com, apps on spacestest.com. This mirrors
694
- // prod's two-zone split because a Worker cannot fetch one in its own zone.
695
- auth: "https://auth.deepspacesites.com",
696
- api: "https://api.deepspacesites.com",
697
- platform: "https://platform.deepspacesites.com",
698
- deploy: "https://deploy.deepspacesites.com"
728
+ var serviceUrls = (plane) => {
729
+ const { auth: auth2, api: api4, platform, deploy } = PLANES[plane];
730
+ return { auth: auth2, api: api4, platform, deploy };
699
731
  };
732
+ var PROD_URLS = serviceUrls("production");
733
+ var STAGING_URLS = serviceUrls("staging");
734
+ var MEDICAL_URLS = serviceUrls("medical");
700
735
  var INVALID_URLS = {
701
736
  auth: "http://127.0.0.1:9",
702
737
  api: "http://127.0.0.1:9",
@@ -704,19 +739,21 @@ var INVALID_URLS = {
704
739
  deploy: "http://127.0.0.1:9"
705
740
  };
706
741
  function appDomainForEnv(env) {
707
- return env === "production" ? "app.space" : env === "staging" ? "spacestest.com" : null;
742
+ return env === "invalid" ? null : PLANES[env].appDomain;
708
743
  }
709
744
  function platformDomainForEnv(env) {
710
- return env === "production" ? "deep.space" : env === "staging" ? "deepspacesites.com" : null;
745
+ return env === "invalid" ? null : PLANES[env].platformDomain;
711
746
  }
712
- var PLATFORM_URLS = DEEPSPACE_ENV === "production" ? PROD_URLS : DEEPSPACE_ENV === "staging" ? STAGING_URLS : INVALID_URLS;
747
+ var PLATFORM_URLS = DEEPSPACE_ENV === "production" ? PROD_URLS : DEEPSPACE_ENV === "staging" ? STAGING_URLS : DEEPSPACE_ENV === "medical" ? MEDICAL_URLS : INVALID_URLS;
713
748
  var PLANE_URLS = {
714
749
  production: PROD_URLS,
715
- staging: STAGING_URLS
750
+ staging: STAGING_URLS,
751
+ medical: MEDICAL_URLS
716
752
  };
717
753
  var PLANE_AUTH_URLS = {
718
754
  production: PLANE_URLS.production.auth,
719
- staging: PLANE_URLS.staging.auth
755
+ staging: PLANE_URLS.staging.auth,
756
+ medical: PLANE_URLS.medical.auth
720
757
  };
721
758
  function effectivePlatformUrls(env = process.env) {
722
759
  return {
@@ -732,7 +769,7 @@ var {
732
769
  platform: PLATFORM_URL,
733
770
  deploy: DEPLOY_URL
734
771
  } = effectivePlatformUrls();
735
- var DASHBOARD_URL = DEEPSPACE_ENV === "production" ? "https://dashboard.deep.space" : DEEPSPACE_ENV === "staging" ? "https://dashboard.deepspacesites.com" : "http://127.0.0.1:9";
772
+ var DASHBOARD_URL = DEEPSPACE_ENV === "invalid" ? "http://127.0.0.1:9" : PLANES[DEEPSPACE_ENV].dashboard;
736
773
 
737
774
  // src/cli/auth.ts
738
775
  import { readFileSync as readFileSync2, existsSync, mkdirSync } from "fs";
@@ -1014,7 +1051,7 @@ var login_default = defineDeepspaceCommand({
1014
1051
  const who = await doEmailLogin(email, password);
1015
1052
  if (!json) {
1016
1053
  console.log(`Logged in as ${who.email} (${who.userId})`);
1017
- console.log(`Dashboard: ${DASHBOARD_URL}`);
1054
+ if (DASHBOARD_URL) console.log(`Dashboard: ${DASHBOARD_URL}`);
1018
1055
  }
1019
1056
  return { data: { email: who.email, userId: who.userId } };
1020
1057
  }
@@ -1057,13 +1094,15 @@ var login_default = defineDeepspaceCommand({
1057
1094
  if (!json) {
1058
1095
  s.stop("Authenticated");
1059
1096
  p4.log.success(`Logged in as ${result.name ?? result.email}`);
1060
- p4.note(
1061
- `Manage your account, deployed apps, billing, and subscription
1097
+ if (DASHBOARD_URL) {
1098
+ p4.note(
1099
+ `Manage your account, deployed apps, billing, and subscription
1062
1100
  plans on the web dashboard:
1063
1101
 
1064
1102
  ${DASHBOARD_URL}`,
1065
- "Dashboard"
1066
- );
1103
+ "Dashboard"
1104
+ );
1105
+ }
1067
1106
  p4.outro("Done");
1068
1107
  }
1069
1108
  return { data: { email: result.email, userId } };
@@ -1686,9 +1725,8 @@ import { existsSync as existsSync6 } from "fs";
1686
1725
  import { tmpdir } from "os";
1687
1726
  import { isAbsolute as isAbsolute2, relative, resolve as resolve3 } from "path";
1688
1727
  function spaceRemoteName(environment = DEEPSPACE_ENV) {
1689
- if (environment === "staging") return "space-staging";
1690
1728
  if (environment === "production") return "space";
1691
- return "space-invalid";
1729
+ return `space-${environment}`;
1692
1730
  }
1693
1731
  var SPACE_REMOTE = spaceRemoteName();
1694
1732
  function spaceTrackingRef(branch, remote = SPACE_REMOTE) {
@@ -1724,7 +1762,7 @@ function entryIsTransient(cwd) {
1724
1762
  return rel === "" || !rel.startsWith("..") && !isAbsolute2(rel);
1725
1763
  }
1726
1764
  function helperEntryUsable(command) {
1727
- const match = /^!(?:DEEPSPACE_ENV=(production|staging) )?'([^']*)' '([^']*)' git-credential$/.exec(command);
1765
+ const match = /^!(?:DEEPSPACE_ENV=(production|staging|medical) )?'([^']*)' '([^']*)' git-credential$/.exec(command);
1728
1766
  const expectedEnvironment = DEEPSPACE_ENV === "production" ? void 0 : DEEPSPACE_ENV;
1729
1767
  if (!match || match[1] !== expectedEnvironment) return false;
1730
1768
  return existsSync6(match[2]) && existsSync6(match[3]);
@@ -1732,7 +1770,7 @@ function helperEntryUsable(command) {
1732
1770
  function credentialHelperCommand(environment = DEEPSPACE_ENV) {
1733
1771
  const entry = process.argv[1];
1734
1772
  if (!entry) throw new Error("CLI entry path is unavailable");
1735
- const environmentPrefix = environment === "staging" ? "DEEPSPACE_ENV=staging " : "";
1773
+ const environmentPrefix = environment === "staging" || environment === "medical" ? `DEEPSPACE_ENV=${environment} ` : "";
1736
1774
  return `!${environmentPrefix}${shQuote(process.execPath)} ${shQuote(entry)} git-credential`;
1737
1775
  }
1738
1776
  function installCredentialHelper(cwd, url) {
@@ -4482,10 +4520,9 @@ import { existsSync as existsSync15, mkdirSync as mkdirSync7, readFileSync as re
4482
4520
  import { homedir as homedir2 } from "os";
4483
4521
  import { join as join13 } from "path";
4484
4522
  var TEST_ACCOUNTS_PATH = join13(homedir2(), ".deepspace", "test-accounts.json");
4485
- var PRODUCTION_AUTH_ORIGIN = "https://auth.deep.space";
4486
- var STAGING_AUTH_ORIGIN = "https://auth.deepspacesites.com";
4487
4523
  function currentTestAccountScope(env = process.env) {
4488
- const selected = env.DEEPSPACE_AUTH_URL ?? (env.DEEPSPACE_ENV === "staging" ? STAGING_AUTH_ORIGIN : PRODUCTION_AUTH_ORIGIN);
4524
+ const plane = env.DEEPSPACE_ENV;
4525
+ const selected = env.DEEPSPACE_AUTH_URL ?? (plane === "staging" || plane === "medical" ? PLANES[plane].auth : PLANES.production.auth);
4489
4526
  return normalizeTestAccountScope(selected);
4490
4527
  }
4491
4528
  function normalizeTestAccountScope(value) {
@@ -5874,7 +5911,7 @@ async function buildDeployBundle(options) {
5874
5911
  let preparedWranglerConfig;
5875
5912
  try {
5876
5913
  preparedWranglerConfig = prepareWranglerEnvConfig(appDir, envName);
5877
- const appDomain = DEEPSPACE_ENV === "staging" ? "spacestest.com" : "app.space";
5914
+ const appDomain = appDomainForEnv(DEEPSPACE_ENV) ?? "app.space";
5878
5915
  execSync2("npx vite build", {
5879
5916
  cwd: appDir,
5880
5917
  stdio: "pipe",
@@ -8267,7 +8304,7 @@ var whoami_default = defineDeepspaceCommand({
8267
8304
  if (payload.exp) {
8268
8305
  console.log(`Expires: ${new Date(payload.exp * 1e3).toISOString()} (renews on use)`);
8269
8306
  }
8270
- console.log(`Dashboard: ${DASHBOARD_URL}`);
8307
+ if (DASHBOARD_URL) console.log(`Dashboard: ${DASHBOARD_URL}`);
8271
8308
  if (isTestAccount) {
8272
8309
  console.log("");
8273
8310
  console.log("Note: this is a test account, not a real OAuth developer.");
@@ -8744,8 +8781,10 @@ function renderSummary(summary) {
8744
8781
  );
8745
8782
  }
8746
8783
  }
8747
- lines.push("");
8748
- lines.push(`Dashboard: ${DASHBOARD_URL}`);
8784
+ if (DASHBOARD_URL) {
8785
+ lines.push("");
8786
+ lines.push(`Dashboard: ${DASHBOARD_URL}`);
8787
+ }
8749
8788
  return lines.join("\n");
8750
8789
  }
8751
8790
  var usage_default = defineDeepspaceCommand({
@@ -11938,7 +11977,7 @@ Context: deepspace ${payload.cliVersion} \xB7 ${payload.nodeVersion} \xB7 ${payl
11938
11977
  } else {
11939
11978
  console.log(`Submitted feedback ${result.report.id} (${result.report.type}).`);
11940
11979
  }
11941
- console.log(`Track triage status at ${DASHBOARD_URL}.`);
11980
+ if (DASHBOARD_URL) console.log(`Track triage status at ${DASHBOARD_URL}.`);
11942
11981
  }
11943
11982
  return { data: { report: result.report } };
11944
11983
  }
@@ -16084,7 +16123,7 @@ import { join as join28, resolve as resolve22 } from "path";
16084
16123
  // package.json
16085
16124
  var package_default = {
16086
16125
  name: "deepspace",
16087
- version: "0.34.0",
16126
+ version: "0.36.0",
16088
16127
  engines: {
16089
16128
  node: ">=22.15.0 <23 || >=24 <25 || >=26 <27"
16090
16129
  },
@@ -16145,7 +16184,7 @@ var package_default = {
16145
16184
  ],
16146
16185
  scripts: {
16147
16186
  build: "node ../../scripts/clean-artifacts.mjs dist --tsbuildinfo && tsup",
16148
- "type-check": "tsc --noEmit",
16187
+ "type-check": "tsc --noEmit && tsc --noEmit -p tsconfig.expo.json",
16149
16188
  test: "vitest run",
16150
16189
  "test:documentation-browser": "playwright test --config src/documentation/runtime/__browser__/playwright.config.ts",
16151
16190
  clean: "node ../../scripts/clean-artifacts.mjs dist --tsbuildinfo",
@@ -16613,7 +16652,7 @@ function assertKnownOptions(argv) {
16613
16652
  var rawArgs = process.argv.slice(2);
16614
16653
  var wantsHelp = rawArgs.some((arg) => arg === "--help" || arg === "-h");
16615
16654
  if (DEEPSPACE_ENV === "invalid") {
16616
- const error = `Invalid DEEPSPACE_ENV=${JSON.stringify(process.env.DEEPSPACE_ENV)}. Use \`staging\`, \`production\`, or unset it; refusing to default to production.`;
16655
+ const error = `Invalid DEEPSPACE_ENV=${JSON.stringify(process.env.DEEPSPACE_ENV)}. Use \`production\`, \`staging\`, \`medical\`, or unset it; refusing to default to production.`;
16617
16656
  if (rawArgs.includes("--json") && !wantsHelp) {
16618
16657
  console.log(JSON.stringify({ ok: false, code: "invalid_environment", error }));
16619
16658
  } else {