@builder.io/ai-utils 0.82.0 → 0.83.0-dev.202607211718.99c5f9cf8

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/src/projects.d.ts CHANGED
@@ -153,7 +153,7 @@ export interface ReadyMessage extends BaseMessage {
153
153
  }
154
154
  export type MachineState = "unknown" | "created" | "starting" | "started" | "stopping" | "stopped" | "suspending" | "suspended" | "replacing" | "destroying" | "destroyed" | "not-found" | "running" | "failed";
155
155
  export type FlyVolumeState = "unknown" | "creating" | "created" | "extending" | "restoring" | "enabling_remote_export" | "hydrating" | "recovering" | "scheduling_destroy" | "pending_destroy" | "failed";
156
- export type GitAuthErrorCode = "git-auth-failed" | "git-auth-failed-root-repo" | "git-auth-failed-folder-added-by" | "git-auth-failed-folder-created-by" | "git-auth-failed-repo-not-found" | "git-auth-failed-repo-renamed" | "git-auth-failed-folder-server-token" | "git-auth-failed-root-repo-server-token" | "git-auth-failed-ghes-unreachable";
156
+ export type GitAuthErrorCode = "git-auth-failed" | "git-auth-failed-root-repo" | "git-auth-failed-folder-added-by" | "git-auth-failed-folder-created-by" | "git-auth-failed-repo-not-found" | "git-auth-failed-repo-renamed" | "git-auth-failed-folder-server-token" | "git-auth-failed-root-repo-server-token" | "git-auth-failed-ghes-unreachable" | "git-auth-reauth-required";
157
157
  /**
158
158
  * Git provider types for diagnostics.
159
159
  */
@@ -1489,9 +1489,8 @@ export declare const ProjectHostingSchema: z.ZodObject<{
1489
1489
  uploading: "uploading";
1490
1490
  }>>;
1491
1491
  publishedCommit: z.ZodOptional<z.ZodString>;
1492
- customDomain: z.ZodOptional<z.ZodString>;
1493
- customDomainVerified: z.ZodOptional<z.ZodBoolean>;
1494
1492
  autoDeploy: z.ZodOptional<z.ZodBoolean>;
1493
+ domainIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
1495
1494
  }, z.core.$strip>;
1496
1495
  export type ProjectHosting = z.infer<typeof ProjectHostingSchema>;
1497
1496
  /**
@@ -1710,6 +1709,113 @@ export declare const GetDeploysResponseSchema: z.ZodObject<{
1710
1709
  }, z.core.$strip>>;
1711
1710
  }, z.core.$strip>;
1712
1711
  export type GetDeploysResponse = z.infer<typeof GetDeploysResponseSchema>;
1712
+ export declare const HostingDomainStatusSchema: z.ZodEnum<{
1713
+ active: "active";
1714
+ failed: "failed";
1715
+ pending: "pending";
1716
+ provisioning: "provisioning";
1717
+ verifying: "verifying";
1718
+ }>;
1719
+ export type HostingDomainStatus = z.infer<typeof HostingDomainStatusSchema>;
1720
+ export declare const HostingDomainKindSchema: z.ZodEnum<{
1721
+ apex: "apex";
1722
+ subdomain: "subdomain";
1723
+ }>;
1724
+ export type HostingDomainKind = z.infer<typeof HostingDomainKindSchema>;
1725
+ /**
1726
+ * Custom domain record, stored at `hosting-domains/{domain}`.
1727
+ * The normalized domain is the doc key — global uniqueness comes for free.
1728
+ * This doc is both the record AND the claim for the domain.
1729
+ */
1730
+ export declare const HostingDomainSchema: z.ZodObject<{
1731
+ domain: z.ZodString;
1732
+ kind: z.ZodEnum<{
1733
+ apex: "apex";
1734
+ subdomain: "subdomain";
1735
+ }>;
1736
+ projectId: z.ZodString;
1737
+ ownerId: z.ZodString;
1738
+ status: z.ZodEnum<{
1739
+ active: "active";
1740
+ failed: "failed";
1741
+ pending: "pending";
1742
+ provisioning: "provisioning";
1743
+ verifying: "verifying";
1744
+ }>;
1745
+ dnsAuthId: z.ZodString;
1746
+ delegationTarget: z.ZodString;
1747
+ trafficTarget: z.ZodOptional<z.ZodString>;
1748
+ certId: z.ZodOptional<z.ZodString>;
1749
+ certMapEntryName: z.ZodOptional<z.ZodString>;
1750
+ httpRouteName: z.ZodOptional<z.ZodString>;
1751
+ createdAt: z.ZodNumber;
1752
+ pendingSince: z.ZodNumber;
1753
+ verifyingSince: z.ZodOptional<z.ZodNumber>;
1754
+ attemptId: z.ZodOptional<z.ZodString>;
1755
+ verifiedAt: z.ZodOptional<z.ZodNumber>;
1756
+ error: z.ZodOptional<z.ZodString>;
1757
+ failedStep: z.ZodOptional<z.ZodEnum<{
1758
+ dns: "dns";
1759
+ https: "https";
1760
+ }>>;
1761
+ createdBy: z.ZodString;
1762
+ }, z.core.$strip>;
1763
+ export type HostingDomain = z.infer<typeof HostingDomainSchema>;
1764
+ export declare const AddDomainRequestSchema: z.ZodObject<{
1765
+ projectId: z.ZodString;
1766
+ domain: z.ZodString;
1767
+ }, z.core.$strip>;
1768
+ export type AddDomainRequest = z.infer<typeof AddDomainRequestSchema>;
1769
+ export declare const AddDomainResponseSchema: z.ZodObject<{
1770
+ domain: z.ZodString;
1771
+ kind: z.ZodEnum<{
1772
+ apex: "apex";
1773
+ subdomain: "subdomain";
1774
+ }>;
1775
+ records: z.ZodObject<{
1776
+ traffic: z.ZodObject<{
1777
+ recordType: z.ZodEnum<{
1778
+ A: "A";
1779
+ CNAME: "CNAME";
1780
+ }>;
1781
+ name: z.ZodString;
1782
+ value: z.ZodString;
1783
+ }, z.core.$strip>;
1784
+ validation: z.ZodObject<{
1785
+ recordType: z.ZodEnum<{
1786
+ A: "A";
1787
+ CNAME: "CNAME";
1788
+ }>;
1789
+ name: z.ZodString;
1790
+ value: z.ZodString;
1791
+ }, z.core.$strip>;
1792
+ }, z.core.$strip>;
1793
+ }, z.core.$strip>;
1794
+ export type AddDomainResponse = z.infer<typeof AddDomainResponseSchema>;
1795
+ export declare const VerifyDomainRequestSchema: z.ZodObject<{
1796
+ projectId: z.ZodString;
1797
+ domain: z.ZodString;
1798
+ }, z.core.$strip>;
1799
+ export type VerifyDomainRequest = z.infer<typeof VerifyDomainRequestSchema>;
1800
+ export declare const VerifyDomainResponseSchema: z.ZodObject<{
1801
+ status: z.ZodEnum<{
1802
+ active: "active";
1803
+ failed: "failed";
1804
+ pending: "pending";
1805
+ provisioning: "provisioning";
1806
+ verifying: "verifying";
1807
+ }>;
1808
+ }, z.core.$strip>;
1809
+ export type VerifyDomainResponse = z.infer<typeof VerifyDomainResponseSchema>;
1810
+ export declare const RemoveDomainRequestSchema: z.ZodObject<{
1811
+ projectId: z.ZodString;
1812
+ domain: z.ZodString;
1813
+ }, z.core.$strip>;
1814
+ export type RemoveDomainRequest = z.infer<typeof RemoveDomainRequestSchema>;
1815
+ export declare const RemoveDomainResponseSchema: z.ZodObject<{
1816
+ success: z.ZodLiteral<true>;
1817
+ }, z.core.$strip>;
1818
+ export type RemoveDomainResponse = z.infer<typeof RemoveDomainResponseSchema>;
1713
1819
  export declare const CloneProjectOptionsSchema: z.ZodObject<{
1714
1820
  sourceProjectId: z.ZodString;
1715
1821
  sourceBranchName: z.ZodDefault<z.ZodString>;
package/src/projects.js CHANGED
@@ -322,12 +322,13 @@ export const ProjectHostingSchema = z.object({
322
322
  lastDeployStatus: DeployStatusSchema.optional(),
323
323
  /** Git commit currently live at the project's hosting URL (set on go-live). */
324
324
  publishedCommit: z.string().optional(),
325
- customDomain: z.string().optional(),
326
- customDomainVerified: z.boolean().optional(),
327
325
  autoDeploy: z
328
326
  .boolean()
329
327
  .optional()
330
328
  .meta({ description: "auto-deploy on push/merge" }),
329
+ domainIds: z.array(z.string()).optional().meta({
330
+ description: "Doc keys (normalized domains) in `hosting-domains` attached to this project. The domain docs are the source of truth; this is only the back-pointer.",
331
+ }),
331
332
  });
332
333
  /**
333
334
  * Canonical "is this project hostable" predicate. Keys off the explicit
@@ -613,6 +614,90 @@ export const GetDeploysRequestSchema = z.object({
613
614
  export const GetDeploysResponseSchema = z.object({
614
615
  deploys: z.array(DeployListItemSchema),
615
616
  });
617
+ export const HostingDomainStatusSchema = z.enum([
618
+ "pending",
619
+ "verifying",
620
+ "provisioning",
621
+ "active",
622
+ "failed",
623
+ ]);
624
+ export const HostingDomainKindSchema = z.enum(["apex", "subdomain"]);
625
+ /**
626
+ * Custom domain record, stored at `hosting-domains/{domain}`.
627
+ * The normalized domain is the doc key — global uniqueness comes for free.
628
+ * This doc is both the record AND the claim for the domain.
629
+ */
630
+ export const HostingDomainSchema = z.object({
631
+ domain: z
632
+ .string()
633
+ .meta({ description: "Doc key — normalized (punycode) domain." }),
634
+ kind: HostingDomainKindSchema,
635
+ projectId: z.string(),
636
+ ownerId: z.string(),
637
+ status: HostingDomainStatusSchema,
638
+ dnsAuthId: z
639
+ .string()
640
+ .meta({ description: "GCP DNS authorization resource name." }),
641
+ delegationTarget: z.string().meta({
642
+ description: "_acme-challenge CNAME value the customer must add.",
643
+ }),
644
+ trafficTarget: z.string().optional().meta({
645
+ description: "The traffic record value: ALB anycast IP for apex domains, `cname.builder.cloud` for subdomains. Persisted so the UI can reconstruct both DNS records after page reload.",
646
+ }),
647
+ certId: z
648
+ .string()
649
+ .optional()
650
+ .meta({ description: "Certificate Manager cert resource name." }),
651
+ certMapEntryName: z.string().optional(),
652
+ httpRouteName: z.string().optional(),
653
+ createdAt: z.number(),
654
+ pendingSince: z.number().meta({
655
+ description: "TTL anchor: set on entering `pending`, re-stamped on `failed`→`pending`.",
656
+ }),
657
+ verifyingSince: z.number().optional().meta({
658
+ description: "Set when the delegation-check poll loop starts (on entering `verifying`). Used for the poll timeout and UI. Cleared on promotion to `provisioning` or on failure.",
659
+ }),
660
+ attemptId: z.string().optional().meta({
661
+ description: "Per-verify-attempt nonce, set on entering `verifying`. Delegation-check polls whose attemptId no longer matches are stale (a newer retry superseded them) and stop early.",
662
+ }),
663
+ verifiedAt: z.number().optional(),
664
+ error: z.string().optional(),
665
+ failedStep: z.enum(["dns", "https"]).optional().meta({
666
+ description: "Which setup step failed, set alongside `status: failed` so the UI can attribute the failure. `dns` = delegation verification, `https` = cert/route provisioning.",
667
+ }),
668
+ createdBy: z.string(),
669
+ });
670
+ export const AddDomainRequestSchema = z.object({
671
+ projectId: z.string(),
672
+ domain: z.string(),
673
+ });
674
+ const DnsRecordSchema = z.object({
675
+ recordType: z.enum(["A", "CNAME"]),
676
+ name: z.string(),
677
+ value: z.string(),
678
+ });
679
+ export const AddDomainResponseSchema = z.object({
680
+ domain: z.string(),
681
+ kind: HostingDomainKindSchema,
682
+ records: z.object({
683
+ traffic: DnsRecordSchema,
684
+ validation: DnsRecordSchema,
685
+ }),
686
+ });
687
+ export const VerifyDomainRequestSchema = z.object({
688
+ projectId: z.string(),
689
+ domain: z.string(),
690
+ });
691
+ export const VerifyDomainResponseSchema = z.object({
692
+ status: HostingDomainStatusSchema,
693
+ });
694
+ export const RemoveDomainRequestSchema = z.object({
695
+ projectId: z.string(),
696
+ domain: z.string(),
697
+ });
698
+ export const RemoveDomainResponseSchema = z.object({
699
+ success: z.literal(true),
700
+ });
616
701
  export const CloneProjectOptionsSchema = z.object({
617
702
  sourceProjectId: z.string().min(1).meta({
618
703
  description: "Project to clone from.",
@@ -0,0 +1,49 @@
1
+ /** Fields common to all VPC connectivity types. */
2
+ interface VpcConnectionBase {
3
+ id: string;
4
+ ownerId: string;
5
+ type: string;
6
+ gcpRegion: string;
7
+ customerDnsServers: string[];
8
+ proxyIp: string;
9
+ enabled: boolean;
10
+ createdAt: number;
11
+ updatedAt: number;
12
+ }
13
+ /** Traditional VPC Peering via bridge VPC. */
14
+ export interface VpcGcpPeering extends VpcConnectionBase {
15
+ type: "gcp-peering";
16
+ gcpProjectId: string;
17
+ gcpNetworkName: string;
18
+ bridgeCidr: string;
19
+ importCustomRoutes: boolean;
20
+ }
21
+ /**
22
+ * PSC Network Attachment — customer creates the network attachment in their VPC,
23
+ * our proxy VM connects to it via a PSC interface on nic1.
24
+ * No bridge VPC or bridge CIDR needed on our side.
25
+ */
26
+ export interface VpcGcpNetworkAttachment extends VpcConnectionBase {
27
+ type: "gcp-network-attachment";
28
+ gcpProjectId: string;
29
+ networkAttachmentName: string;
30
+ }
31
+ /** Discriminated union of all VPC connectivity types. */
32
+ export type VpcPeering = VpcGcpPeering | VpcGcpNetworkAttachment;
33
+ export interface CreateVpcGcpPeeringParams {
34
+ type: "gcp-peering";
35
+ gcpRegion: string;
36
+ gcpProjectId: string;
37
+ gcpNetworkName: string;
38
+ bridgeCidr: string;
39
+ customerDnsServers: string[];
40
+ importCustomRoutes?: boolean;
41
+ }
42
+ export interface CreateVpcGcpNetworkAttachmentParams {
43
+ type: "gcp-network-attachment";
44
+ gcpProjectId: string;
45
+ networkAttachmentName: string;
46
+ customerDnsServers: string[];
47
+ }
48
+ export type CreateVpcPeeringParams = CreateVpcGcpPeeringParams | CreateVpcGcpNetworkAttachmentParams;
49
+ export {};
@@ -0,0 +1 @@
1
+ export {};