@pylonsync/functions 0.5.6 → 0.5.7

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/index.d.ts CHANGED
@@ -26,4 +26,4 @@ export type { WorkflowDefinition, WorkflowRun, WorkflowRunRequest, WorkflowRunne
26
26
  export { resetDb, installTestIsolation } from "./testing";
27
27
  export { slugifyName, availableSlug } from "./slugify";
28
28
  export type { SsrResponse, SsrCookieOptions, SsrMetadata, Sitemap, SitemapEntry, Robots, RobotsRule, } from "./ssr-runtime";
29
- export type { QueryCtx, MutationCtx, ActionCtx, DbReader, DbWriter, Stream, Scheduler, AuthInfo, AuthMode, AuthRequirement, FnDefinition, Validator, AnyValidator, ValidatorSchema, InferValidator, InferArgs, RequireMember, RequireMemberOptions, MemberRow, Workflows, VectorSearchQuery, VectorSearchResult, SearchResult, PaginationResult, Llm, LlmMessage, LlmContentBlock, LlmTool, LlmCompleteRequest, LlmCompleteResponse, LlmStreamEvent, Rooms, Domains, TenantDomainResult, TenantDomainDns, } from "./types";
29
+ export type { QueryCtx, MutationCtx, ActionCtx, DbReader, DbWriter, Stream, Scheduler, AuthInfo, AuthMode, AuthRequirement, FnDefinition, Validator, AnyValidator, ValidatorSchema, InferValidator, InferArgs, RequireMember, RequireMemberOptions, MemberRow, Workflows, VectorSearchQuery, VectorSearchResult, SearchResult, PaginationResult, Llm, LlmMessage, LlmContentBlock, LlmTool, LlmCompleteRequest, LlmCompleteResponse, LlmStreamEvent, Rooms, Domains, TenantDomainResult, TenantDomainDns, DomainAvailability, DomainContact, RegisterDomainOptions, RegisteredDomainResult, } from "./types";
package/dist/types.d.ts CHANGED
@@ -819,6 +819,67 @@ export interface TenantDomainResult {
819
819
  * const s = await ctx.domains.status("app.customer.com"); // s.active === true
820
820
  * ```
821
821
  */
822
+ /** One domain-availability / pricing result from a search. */
823
+ export interface DomainAvailability {
824
+ domainName: string;
825
+ sld: string;
826
+ tld: string;
827
+ purchasable: boolean;
828
+ premium?: boolean;
829
+ /** First-term price (USD), when purchasable. */
830
+ purchasePrice?: number;
831
+ renewalPrice?: number;
832
+ purchaseType?: string;
833
+ /** Why it isn't purchasable, when unavailable. */
834
+ reason?: string | null;
835
+ }
836
+ /** A registrant/admin/tech/billing contact for a domain registration. */
837
+ export interface DomainContact {
838
+ firstName: string;
839
+ lastName: string;
840
+ companyName?: string;
841
+ address1: string;
842
+ address2?: string;
843
+ city: string;
844
+ state: string;
845
+ zip: string;
846
+ country: string;
847
+ email: string;
848
+ phone: string;
849
+ fax?: string;
850
+ }
851
+ /** Options for {@link Domains.register}. `purchasePrice` is a price ceiling —
852
+ * registration is refused if the real price is higher, so a premium name can't
853
+ * surprise-charge. Contacts default to the platform account's when omitted. */
854
+ export interface RegisterDomainOptions {
855
+ years?: number;
856
+ autorenewEnabled?: boolean;
857
+ privacyEnabled?: boolean;
858
+ nameservers?: string[];
859
+ contacts?: {
860
+ registrant: DomainContact;
861
+ admin?: DomainContact;
862
+ tech?: DomainContact;
863
+ billing?: DomainContact;
864
+ };
865
+ purchasePrice?: number;
866
+ promoCode?: string;
867
+ }
868
+ /** Result of a domain registration. */
869
+ export interface RegisteredDomainResult {
870
+ domain: {
871
+ domainName: string;
872
+ createDate?: string;
873
+ expireDate?: string;
874
+ autorenewEnabled?: boolean;
875
+ locked?: boolean;
876
+ privacyEnabled?: boolean;
877
+ nameservers?: string[];
878
+ renewalPrice?: number;
879
+ };
880
+ order?: number;
881
+ totalPaid?: number;
882
+ }
822
883
  export interface Domains {
823
884
  /** Attach a custom domain for one of your end-customers. Returns the DNS the
824
885
  * customer must set (the CNAME target + ownership/DCV TXT records). */
@@ -834,6 +895,19 @@ export interface Domains {
834
895
  list(): Promise<{
835
896
  hosts: string[];
836
897
  }>;
898
+ /** Search domain availability + pricing to buy. A `query` with a dot is an
899
+ * exact check ("acme.com"); a bare keyword ("acme") returns suggestions.
900
+ * Requires the registrar (name.com) to be configured on the control plane. */
901
+ search(query: string, opts?: {
902
+ suggest?: boolean;
903
+ tldFilter?: string[];
904
+ }): Promise<{
905
+ results: DomainAvailability[];
906
+ }>;
907
+ /** REGISTER (buy) a domain for your end-customer. Spends money on the
908
+ * platform's registrar account; requires a paid plan. Buying does not by
909
+ * itself serve the app — attach a host with `add()` afterward. */
910
+ register(domainName: string, opts?: RegisterDomainOptions): Promise<RegisteredDomainResult>;
837
911
  }
838
912
  export interface ActionCtx<R extends AuthRequirement = "optional"> {
839
913
  auth: AuthInfo<R>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pylonsync/functions",
3
- "version": "0.5.6",
3
+ "version": "0.5.7",
4
4
  "description": "TypeScript function runtime for pylon — defines server-side queries, mutations, and actions.",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
package/src/index.ts CHANGED
@@ -95,4 +95,8 @@ export type {
95
95
  Domains,
96
96
  TenantDomainResult,
97
97
  TenantDomainDns,
98
+ DomainAvailability,
99
+ DomainContact,
100
+ RegisterDomainOptions,
101
+ RegisteredDomainResult,
98
102
  } from "./types";
package/src/runtime.ts CHANGED
@@ -33,6 +33,9 @@ import type {
33
33
  Connections,
34
34
  Domains,
35
35
  TenantDomainResult,
36
+ DomainAvailability,
37
+ RegisterDomainOptions,
38
+ RegisteredDomainResult,
36
39
  QueryCtx,
37
40
  MutationCtx,
38
41
  ActionCtx,
@@ -1119,6 +1122,16 @@ function buildDomains(): Domains {
1119
1122
  hostname,
1120
1123
  }),
1121
1124
  list: () => call<{ hosts: string[] }>("listProjectTrustedHosts", {}),
1125
+ search: (query: string, opts?: { suggest?: boolean; tldFilter?: string[] }) =>
1126
+ call<{ results: DomainAvailability[] }>("searchAvailableDomains", {
1127
+ query,
1128
+ ...(opts ?? {}),
1129
+ }),
1130
+ register: (domainName: string, opts?: RegisterDomainOptions) =>
1131
+ call<RegisteredDomainResult>("registerCustomerDomain", {
1132
+ domainName,
1133
+ ...(opts ?? {}),
1134
+ }),
1122
1135
  };
1123
1136
  }
1124
1137
 
package/src/types.ts CHANGED
@@ -919,6 +919,71 @@ export interface TenantDomainResult {
919
919
  * const s = await ctx.domains.status("app.customer.com"); // s.active === true
920
920
  * ```
921
921
  */
922
+ /** One domain-availability / pricing result from a search. */
923
+ export interface DomainAvailability {
924
+ domainName: string;
925
+ sld: string;
926
+ tld: string;
927
+ purchasable: boolean;
928
+ premium?: boolean;
929
+ /** First-term price (USD), when purchasable. */
930
+ purchasePrice?: number;
931
+ renewalPrice?: number;
932
+ purchaseType?: string;
933
+ /** Why it isn't purchasable, when unavailable. */
934
+ reason?: string | null;
935
+ }
936
+
937
+ /** A registrant/admin/tech/billing contact for a domain registration. */
938
+ export interface DomainContact {
939
+ firstName: string;
940
+ lastName: string;
941
+ companyName?: string;
942
+ address1: string;
943
+ address2?: string;
944
+ city: string;
945
+ state: string;
946
+ zip: string;
947
+ country: string;
948
+ email: string;
949
+ phone: string;
950
+ fax?: string;
951
+ }
952
+
953
+ /** Options for {@link Domains.register}. `purchasePrice` is a price ceiling —
954
+ * registration is refused if the real price is higher, so a premium name can't
955
+ * surprise-charge. Contacts default to the platform account's when omitted. */
956
+ export interface RegisterDomainOptions {
957
+ years?: number;
958
+ autorenewEnabled?: boolean;
959
+ privacyEnabled?: boolean;
960
+ nameservers?: string[];
961
+ contacts?: {
962
+ registrant: DomainContact;
963
+ admin?: DomainContact;
964
+ tech?: DomainContact;
965
+ billing?: DomainContact;
966
+ };
967
+ purchasePrice?: number;
968
+ promoCode?: string;
969
+ }
970
+
971
+ /** Result of a domain registration. */
972
+ export interface RegisteredDomainResult {
973
+ domain: {
974
+ domainName: string;
975
+ createDate?: string;
976
+ expireDate?: string;
977
+ autorenewEnabled?: boolean;
978
+ locked?: boolean;
979
+ privacyEnabled?: boolean;
980
+ nameservers?: string[];
981
+ renewalPrice?: number;
982
+ };
983
+ order?: number;
984
+ totalPaid?: number;
985
+ }
986
+
922
987
  export interface Domains {
923
988
  /** Attach a custom domain for one of your end-customers. Returns the DNS the
924
989
  * customer must set (the CNAME target + ownership/DCV TXT records). */
@@ -929,6 +994,20 @@ export interface Domains {
929
994
  remove(hostname: string): Promise<{ hostname: string; removed: boolean }>;
930
995
  /** The hostnames currently ready (trusted) for this app — owner + tenant. */
931
996
  list(): Promise<{ hosts: string[] }>;
997
+ /** Search domain availability + pricing to buy. A `query` with a dot is an
998
+ * exact check ("acme.com"); a bare keyword ("acme") returns suggestions.
999
+ * Requires the registrar (name.com) to be configured on the control plane. */
1000
+ search(
1001
+ query: string,
1002
+ opts?: { suggest?: boolean; tldFilter?: string[] },
1003
+ ): Promise<{ results: DomainAvailability[] }>;
1004
+ /** REGISTER (buy) a domain for your end-customer. Spends money on the
1005
+ * platform's registrar account; requires a paid plan. Buying does not by
1006
+ * itself serve the app — attach a host with `add()` afterward. */
1007
+ register(
1008
+ domainName: string,
1009
+ opts?: RegisterDomainOptions,
1010
+ ): Promise<RegisteredDomainResult>;
932
1011
  }
933
1012
 
934
1013
  export interface ActionCtx<R extends AuthRequirement = "optional"> {