@erdoai/cli 0.167.0 → 0.170.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.
Files changed (2) hide show
  1. package/dist/index.js +20 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -522,6 +522,13 @@ var ErdoClient = class {
522
522
  { manager_default: managerDefault }
523
523
  );
524
524
  }
525
+ setCustomDomainHome(domain, homeArtifactId) {
526
+ return this.request(
527
+ "PATCH",
528
+ `/v1/custom-domains/${encodeURIComponent(domain)}/home`,
529
+ { home_artifact_id: homeArtifactId }
530
+ );
531
+ }
525
532
  deleteCustomDomain(domain) {
526
533
  return this.request(
527
534
  "DELETE",
@@ -6281,8 +6288,9 @@ domainsCmd.command("list").description("List the org's custom domains with live
6281
6288
  for (const d of domains) {
6282
6289
  const checked = d.last_checked_at ? `checked ${d.last_checked_at}` : "never checked";
6283
6290
  const managerDefault = d.manager_default ? " manager default" : "";
6291
+ const home = d.home_artifact_id ? ` home ${d.home_artifact_id}` : "";
6284
6292
  const reason = d.error_reason ? ` ${d.error_reason}` : "";
6285
- console.log(`${d.domain} ${d.status} ${checked}${managerDefault}${reason}`);
6293
+ console.log(`${d.domain} ${d.status} ${checked}${managerDefault}${home}${reason}`);
6286
6294
  }
6287
6295
  } catch (e) {
6288
6296
  fail(e);
@@ -6319,6 +6327,17 @@ domainsCmd.command("manager-default <domain>").description(
6319
6327
  fail(e);
6320
6328
  }
6321
6329
  });
6330
+ domainsCmd.command("home <domain> [artifactId]").description("Set the domain root's public home page, or clear it with --unset").option("--unset", "clear the home page (the domain root will return 404)").action(async (domain, artifactId, opts) => {
6331
+ try {
6332
+ if (opts.unset ? artifactId !== void 0 : !artifactId) {
6333
+ throw new Error("Provide a page artifact ID, or use --unset without an ID");
6334
+ }
6335
+ const d = await new ErdoClient().setCustomDomainHome(domain, opts.unset ? null : artifactId);
6336
+ console.log(d.home_artifact_id ? `${d.domain} home page: /p/${d.home_artifact_id}` : `${d.domain} home page cleared (the domain root returns 404)`);
6337
+ } catch (e) {
6338
+ fail(e);
6339
+ }
6340
+ });
6322
6341
  domainsCmd.command("remove <domain>").description("Remove a custom domain registration (stops it serving pages)").action(async (domain) => {
6323
6342
  try {
6324
6343
  const res = await new ErdoClient().deleteCustomDomain(domain);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@erdoai/cli",
3
- "version": "0.167.0",
3
+ "version": "0.170.0",
4
4
  "description": "Erdo CLI \u2014 drive datasets, pages, and evals from the terminal or CI",
5
5
  "type": "module",
6
6
  "bin": {