@homespunapps/core 1.6.21 → 1.6.23

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/client.d.ts CHANGED
@@ -360,22 +360,31 @@ export declare class HomespunClient {
360
360
  status: string;
361
361
  }>;
362
362
  /**
363
- * POST /v1/apps/:id/domain - bind a custom domain to the app. Returns the
364
- * record including `dns_records`: the DNS entries the domain owner must
365
- * publish (the routing CNAME plus any Cloudflare validation records).
363
+ * POST /v1/apps/:id/domain - bind a custom domain to the app. The FIRST
364
+ * domain bound serves the app; every one after it becomes an alias that
365
+ * redirects there (`redirect_to`). Returns the record including
366
+ * `dns_records`: the DNS entries the domain owner must publish (the routing
367
+ * CNAME plus any Cloudflare validation records).
366
368
  */
367
369
  setAppDomain(appId: string, domain: string): Promise<AppDomain>;
368
370
  /**
369
- * GET /v1/apps/:id/domain - the app's domain record, live-refreshed against
370
- * Cloudflare when the feature is enabled (status/last_error/last_checked_at
371
- * update as a side effect).
371
+ * GET /v1/apps/:id/domain - the app's SERVING domain at the top level with
372
+ * its `aliases` beside it, live-refreshed against Cloudflare when the
373
+ * feature is enabled (status/last_error/last_checked_at update as a side
374
+ * effect).
372
375
  */
373
376
  getAppDomain(appId: string): Promise<AppDomain>;
374
377
  /**
375
378
  * DELETE /v1/apps/:id/domain - remove the domain binding (Cloudflare
376
379
  * hostname best-effort + record + quota release). Idempotent.
377
380
  */
378
- deleteAppDomain(appId: string): Promise<void>;
381
+ /**
382
+ * Unbind the app's custom domains. With no `domain` every binding goes;
383
+ * with one, only that binding, except that removing the primary takes its
384
+ * aliases with it (an alias pointing at a domain the app no longer holds
385
+ * would redirect visitors into nothing).
386
+ */
387
+ deleteAppDomain(appId: string, domain?: string): Promise<void>;
379
388
  /**
380
389
  * POST /v1/apps/:id/members — add or invite a member by email. If a Human
381
390
  * already exists for the email, the member row is created immediately
@@ -890,10 +899,18 @@ export interface AppDomain {
890
899
  status: "pending" | "active" | "error" | "removed";
891
900
  dns_records: AppDomainDnsRecord[];
892
901
  cf_hostname_id: string | null;
902
+ cf_worker_route_id?: string | null;
903
+ /** Null on the serving domain; on an alias, the domain it redirects to. */
904
+ redirect_to?: string | null;
893
905
  last_error: string | null;
894
906
  last_checked_at: string | null;
895
907
  created_at: string;
896
908
  updated_at: string;
909
+ /**
910
+ * Present on the GET response only: the app's other domains, each of which
911
+ * redirects to the one carried at the top level.
912
+ */
913
+ aliases?: AppDomain[];
897
914
  }
898
915
  /**
899
916
  * One member row — the shape `listAppMembers` returns and the `member` half
package/dist/client.js CHANGED
@@ -673,14 +673,18 @@ export class HomespunClient {
673
673
  return this.asObject(r);
674
674
  }
675
675
  // -------------------------------------------------------------------------
676
- // Custom domains (Cloudflare for SaaS). One primary domain per app. The
677
- // relay rejects setAppDomain with `custom_domains_not_enabled` (501) when
678
- // the deployment has no Cloudflare configuration.
676
+ // Custom domains (Cloudflare for SaaS). An app holds one domain that SERVES
677
+ // plus any number of aliases that redirect to it; the first domain bound
678
+ // becomes the serving one. The relay rejects setAppDomain with
679
+ // `custom_domains_not_enabled` (501) when the deployment has no Cloudflare
680
+ // configuration.
679
681
  // -------------------------------------------------------------------------
680
682
  /**
681
- * POST /v1/apps/:id/domain - bind a custom domain to the app. Returns the
682
- * record including `dns_records`: the DNS entries the domain owner must
683
- * publish (the routing CNAME plus any Cloudflare validation records).
683
+ * POST /v1/apps/:id/domain - bind a custom domain to the app. The FIRST
684
+ * domain bound serves the app; every one after it becomes an alias that
685
+ * redirects there (`redirect_to`). Returns the record including
686
+ * `dns_records`: the DNS entries the domain owner must publish (the routing
687
+ * CNAME plus any Cloudflare validation records).
684
688
  */
685
689
  async setAppDomain(appId, domain) {
686
690
  const r = await this.call("POST", `/v1/apps/${encodeURIComponent(appId)}/domain`, { domain });
@@ -689,9 +693,10 @@ export class HomespunClient {
689
693
  return this.asObject(r);
690
694
  }
691
695
  /**
692
- * GET /v1/apps/:id/domain - the app's domain record, live-refreshed against
693
- * Cloudflare when the feature is enabled (status/last_error/last_checked_at
694
- * update as a side effect).
696
+ * GET /v1/apps/:id/domain - the app's SERVING domain at the top level with
697
+ * its `aliases` beside it, live-refreshed against Cloudflare when the
698
+ * feature is enabled (status/last_error/last_checked_at update as a side
699
+ * effect).
695
700
  */
696
701
  async getAppDomain(appId) {
697
702
  const r = await this.call("GET", `/v1/apps/${encodeURIComponent(appId)}/domain`);
@@ -703,8 +708,15 @@ export class HomespunClient {
703
708
  * DELETE /v1/apps/:id/domain - remove the domain binding (Cloudflare
704
709
  * hostname best-effort + record + quota release). Idempotent.
705
710
  */
706
- async deleteAppDomain(appId) {
707
- const r = await this.call("DELETE", `/v1/apps/${encodeURIComponent(appId)}/domain`);
711
+ /**
712
+ * Unbind the app's custom domains. With no `domain` every binding goes;
713
+ * with one, only that binding, except that removing the primary takes its
714
+ * aliases with it (an alias pointing at a domain the app no longer holds
715
+ * would redirect visitors into nothing).
716
+ */
717
+ async deleteAppDomain(appId, domain) {
718
+ const query = domain ? `?domain=${encodeURIComponent(domain)}` : "";
719
+ const r = await this.call("DELETE", `/v1/apps/${encodeURIComponent(appId)}/domain${query}`);
708
720
  if (!r.ok)
709
721
  this.fail(r);
710
722
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@homespunapps/core",
3
- "version": "1.6.21",
3
+ "version": "1.6.23",
4
4
  "description": "Homespun relay client: typed HTTP + WebSocket operations against a Homespun relay. Framework-free.",
5
5
  "license": "MIT",
6
6
  "type": "module",