deepspace 0.32.1 → 0.33.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.
package/dist/cli.js CHANGED
@@ -9909,7 +9909,7 @@ var list2 = defineDeepspaceCommand({
9909
9909
  );
9910
9910
  for (const d of result.domains) {
9911
9911
  console.log(
9912
- `${d.domain.padEnd(35)} ${d.appId.padEnd(20)} ${d.status.padEnd(20)} ${fmtDate(d.expiresAt).padEnd(12)} ${d.autoRenew ? "on" : "off"}`
9912
+ `${d.domain.padEnd(35)} ${d.appId.padEnd(20)} ${d.status.padEnd(20)} ${fmtDate(d.expiresAt).padEnd(12)} ${d.registrar === "external" ? "external" : d.autoRenew ? "on" : "off"}`
9913
9913
  );
9914
9914
  }
9915
9915
  }
@@ -9941,29 +9941,119 @@ var status = defineDeepspaceCommand({
9941
9941
  );
9942
9942
  console.log(`Attached app: ${found.appId}`);
9943
9943
  console.log(`Registrar: ${found.registrar}`);
9944
- console.log(`Registered: ${fmtDate(found.registeredAt)}`);
9945
- console.log(`Expires: ${fmtDate(found.expiresAt)}`);
9946
- console.log(`Auto-renew: ${found.autoRenew ? "on" : "off"}`);
9947
- console.log(`Charged: ${fmtCents(found.chargedCents)}/yr`);
9944
+ if (found.registrar === "external") {
9945
+ console.log("Renewal: Managed at your registrar");
9946
+ printExternalDomain(found);
9947
+ } else {
9948
+ console.log(`Registered: ${fmtDate(found.registeredAt)}`);
9949
+ console.log(`Expires: ${fmtDate(found.expiresAt)}`);
9950
+ console.log(`Auto-renew: ${found.autoRenew ? "on" : "off"}`);
9951
+ console.log(`Charged: ${fmtCents(found.chargedCents)}/yr`);
9952
+ }
9948
9953
  }
9949
9954
  return { data: scrubInternal({ ...found }) };
9950
9955
  }
9951
9956
  });
9952
- var attach = defineDeepspaceCommand({
9953
- meta: { name: "attach", description: "Re-point a domain at a different app" },
9957
+ function printExternalDomain(domain) {
9958
+ console.log(`${domain.domain}: ${domain.status}`);
9959
+ for (const record of domain.dnsRecords ?? []) {
9960
+ console.log(`${record.type.padEnd(5)} ${record.name} \u2192 ${record.value} (${record.purpose})`);
9961
+ }
9962
+ if (domain.status !== "active")
9963
+ console.log(
9964
+ "Add these DNS records at your registrar, then run the verification command below. Keep certificate CNAME records for automatic renewal."
9965
+ );
9966
+ }
9967
+ var verify = defineDeepspaceCommand({
9968
+ meta: {
9969
+ name: "verify",
9970
+ description: "Verify DNS ownership and activate an externally registered domain"
9971
+ },
9954
9972
  args: {
9955
- domain: { type: "positional", description: "Domain to re-point", required: true },
9956
- app: { type: "string", description: "Target app id or live name (defaults to ./wrangler.toml)" }
9973
+ domain: { type: "positional", description: "External domain", required: true },
9974
+ app: {
9975
+ type: "string",
9976
+ description: "Target app id or live name (defaults to ./wrangler.toml)"
9977
+ }
9957
9978
  },
9958
9979
  async run({ args }) {
9959
- const domain = String(args.domain);
9960
9980
  const token = await ensureToken();
9961
- const targetAppId = await resolveAppTarget(
9962
- DEPLOY_URL,
9981
+ const appId = await resolveAppTarget(DEPLOY_URL, token, args.app);
9982
+ const { domain } = await api(
9963
9983
  token,
9964
- args.app
9984
+ "/api/domains/external/verify",
9985
+ {
9986
+ method: "POST",
9987
+ body: JSON.stringify({ domain: String(args.domain), appId })
9988
+ }
9965
9989
  );
9990
+ if (!args.json) printExternalDomain(domain);
9991
+ return {
9992
+ data: { ...domain },
9993
+ action: domain.status === "active" ? void 0 : cliAction("deepspace", "app", "domain", "verify", domain.domain, "--app", appId)
9994
+ };
9995
+ }
9996
+ });
9997
+ var attach = defineDeepspaceCommand({
9998
+ meta: {
9999
+ name: "attach",
10000
+ description: "Attach a domain; use --external for a domain bought elsewhere"
10001
+ },
10002
+ args: {
10003
+ domain: { type: "positional", description: "Domain to attach", required: true },
10004
+ external: {
10005
+ type: "boolean",
10006
+ description: "Connect a domain registered elsewhere without buying or transferring it"
10007
+ },
10008
+ app: {
10009
+ type: "string",
10010
+ description: "Target app id or live name (defaults to ./wrangler.toml)"
10011
+ }
10012
+ },
10013
+ async run({ args }) {
10014
+ const domain = String(args.domain);
10015
+ const token = await ensureToken();
10016
+ const targetAppId = await resolveAppTarget(DEPLOY_URL, token, args.app);
10017
+ if (args.external) {
10018
+ const result2 = await api(token, "/api/domains/external", {
10019
+ method: "POST",
10020
+ body: JSON.stringify({ domain, appId: targetAppId })
10021
+ });
10022
+ if (!args.json) printExternalDomain(result2.domain);
10023
+ return {
10024
+ data: { ...result2.domain },
10025
+ action: cliAction(
10026
+ "deepspace",
10027
+ "app",
10028
+ "domain",
10029
+ "verify",
10030
+ result2.domain.domain,
10031
+ "--app",
10032
+ targetAppId
10033
+ )
10034
+ };
10035
+ }
9966
10036
  const found = await requireDomain(token, domain);
10037
+ if (found.registrar === "external") {
10038
+ if (found.appId !== targetAppId)
10039
+ throw new Refusal(
10040
+ "Detach the external domain before connecting it to another app",
10041
+ "external_domain_attached"
10042
+ );
10043
+ const { domain: result2 } = await api(
10044
+ token,
10045
+ "/api/domains/external/verify",
10046
+ {
10047
+ method: "POST",
10048
+ body: JSON.stringify({ domain, appId: targetAppId })
10049
+ }
10050
+ );
10051
+ if (!args.json) printExternalDomain(result2);
10052
+ return {
10053
+ data: { ...result2 },
10054
+ action: result2.status === "active" ? void 0 : cliAction("deepspace", "app", "domain", "verify", domain, "--app", targetAppId)
10055
+ };
10056
+ }
9967
10057
  const result = await api(
9968
10058
  token,
9969
10059
  `/api/domains/${found.id}/reattach`,
@@ -9999,7 +10089,7 @@ var detach = defineDeepspaceCommand({
9999
10089
  await api(token, `/api/domains/${found.id}`, { method: "DELETE" });
10000
10090
  if (!args.json) {
10001
10091
  console.log(
10002
- `\u2713 ${domain} detached. Use \`deepspace app domain attach\` to re-route, or \`renew --auto off\` to stop auto-renewal.`
10092
+ found.registrar === "external" ? `\u2713 ${domain} detached. Remove its DeepSpace DNS records at your registrar; registration and renewal are unchanged.` : `\u2713 ${domain} detached. Use \`deepspace app domain attach\` to re-route, or \`renew --auto off\` to stop auto-renewal.`
10003
10093
  );
10004
10094
  }
10005
10095
  return { data: { domain, detached: true } };
@@ -10018,6 +10108,11 @@ var renew = defineDeepspaceCommand({
10018
10108
  }
10019
10109
  const token = await ensureToken();
10020
10110
  const found = await requireDomain(token, domain);
10111
+ if (found.registrar === "external")
10112
+ throw new Refusal(
10113
+ "Manage renewal at the registrar where you bought this domain",
10114
+ "external_renewal"
10115
+ );
10021
10116
  const enabled = args.auto === "on";
10022
10117
  await api(token, `/api/domains/${found.id}/auto-renew`, {
10023
10118
  method: "POST",
@@ -10029,7 +10124,7 @@ var renew = defineDeepspaceCommand({
10029
10124
  });
10030
10125
  var domain_default = defineCommand5({
10031
10126
  meta: { name: "domain", description: "Buy and manage custom domains" },
10032
- subCommands: { search, buy, list: list2, status, attach, detach, renew }
10127
+ subCommands: { search, buy, list: list2, status, attach, verify, detach, renew }
10033
10128
  });
10034
10129
 
10035
10130
  // src/cli/commands/app-files.ts
@@ -15950,7 +16045,7 @@ import { join as join28, resolve as resolve22 } from "path";
15950
16045
  // package.json
15951
16046
  var package_default = {
15952
16047
  name: "deepspace",
15953
- version: "0.32.1",
16048
+ version: "0.33.1",
15954
16049
  engines: {
15955
16050
  node: ">=22.15.0 <23 || >=24 <25 || >=26 <27"
15956
16051
  },