@fwgapps/namecheap 0.3.0 → 0.4.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/README.md +52 -53
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +99 -2
- package/dist/index.d.ts +99 -2
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +9 -2
package/dist/index.d.cts
CHANGED
|
@@ -465,6 +465,12 @@ declare const GetAddFundsStatus: {
|
|
|
465
465
|
readonly Expired: "EXPIRED";
|
|
466
466
|
};
|
|
467
467
|
type GetAddFundsStatus = (typeof GetAddFundsStatus)[keyof typeof GetAddFundsStatus];
|
|
468
|
+
declare const DomainDnsTag: {
|
|
469
|
+
Issue: string;
|
|
470
|
+
IssueWild: string;
|
|
471
|
+
IODEF: string;
|
|
472
|
+
};
|
|
473
|
+
type DomainDnsTag = (typeof DomainDnsTag)[keyof typeof DomainDnsTag];
|
|
468
474
|
|
|
469
475
|
interface GetListParams$1 {
|
|
470
476
|
listType?: DomainListType;
|
|
@@ -573,7 +579,7 @@ interface SetDNSHostsParams {
|
|
|
573
579
|
tld: string;
|
|
574
580
|
emailType?: EmailType;
|
|
575
581
|
flag?: number;
|
|
576
|
-
tag?:
|
|
582
|
+
tag?: DomainDnsTag;
|
|
577
583
|
hostname: Array<string>;
|
|
578
584
|
ttl: Array<number>;
|
|
579
585
|
address: Array<string>;
|
|
@@ -583,13 +589,104 @@ interface SetDNSHostsParams {
|
|
|
583
589
|
|
|
584
590
|
declare class DomainsDNS {
|
|
585
591
|
private readonly config;
|
|
592
|
+
/**
|
|
593
|
+
* @constructor initial configuration to use global settings
|
|
594
|
+
* @param {NamecheapProps} config Namecheap credentials
|
|
595
|
+
*/
|
|
586
596
|
constructor(config: NamecheapProps);
|
|
597
|
+
/**
|
|
598
|
+
* Sets domain to use our default DNS servers.
|
|
599
|
+
* Required for free services like Host record management, URL forwarding, email forwarding, dynamic dns and other value added services.
|
|
600
|
+
* @param {string} sld SLD of the DomainName
|
|
601
|
+
* @param {string} tld TLD of the DomainName
|
|
602
|
+
* @returns {Promise<>string>} Returns the domain name that you are trying to set default nameservers for.
|
|
603
|
+
*/
|
|
587
604
|
setDefault(sld: string, tld: string): Promise<string>;
|
|
605
|
+
/**
|
|
606
|
+
* Sets domain to use custom DNS servers.
|
|
607
|
+
* @note Services like URL forwarding, Email forwarding, Dynamic DNS will not work for domains using custom nameservers
|
|
608
|
+
* @param {string} sld SLD of the DomainName
|
|
609
|
+
* @param {string} tld TLD of the DomainName
|
|
610
|
+
* @param {Array<string>} nameservers A list of name servers to be associated with this domain
|
|
611
|
+
* @returns {Promise<string>} Returns the domain name that you are trying to set custom nameservers for.
|
|
612
|
+
*/
|
|
588
613
|
setCustom(sld: string, tld: string, nameservers: Array<string>): Promise<string>;
|
|
614
|
+
/**
|
|
615
|
+
* Gets a list of DNS servers associated with the requested domain.
|
|
616
|
+
* @param {string} sld SLD of the DomainName
|
|
617
|
+
* @param {string} tld TLD of the DomainName
|
|
618
|
+
* @returns List of DNS info (see {@link DomainDnsGetListResult})
|
|
619
|
+
*/
|
|
589
620
|
getList(sld: string, tld: string): Promise<DomainDnsGetListResult>;
|
|
621
|
+
/**
|
|
622
|
+
* Retrieves DNS host record settings for the requested domain.
|
|
623
|
+
* @param {string} sld SLD of the DomainName
|
|
624
|
+
* @param {string} tld TLD of the DomainName
|
|
625
|
+
* @returns DNS host records info (see {@link DomainDnsGetHostsResult})
|
|
626
|
+
*/
|
|
590
627
|
getHosts(sld: string, tld: string): Promise<DomainDnsGetHostsResult>;
|
|
628
|
+
/**
|
|
629
|
+
* Gets email forwarding settings for the requested domain.
|
|
630
|
+
* @param {string} domain Domain name to get settings
|
|
631
|
+
* @returns Email forwarding info (see {@link DomainDnsGetEmailForwardingResult})
|
|
632
|
+
*/
|
|
591
633
|
getEmailForwarding(domain: string): Promise<DomainDnsGetEmailForwardingResult>;
|
|
634
|
+
/**
|
|
635
|
+
* Sets email forwarding for a domain name.
|
|
636
|
+
* @param {string} domain Domain name to set settings
|
|
637
|
+
* @param {SetDNSEmailForwardingParams} params Set mailbox and forwards
|
|
638
|
+
* - mailBox: for which you wish to set email forwarding.
|
|
639
|
+
* - forwardTo: Email address to forward to
|
|
640
|
+
* @example
|
|
641
|
+
* setEmailForwarding("mydomain.com", {
|
|
642
|
+
* mailBox: ["example@namecheap.com"],
|
|
643
|
+
* forwardTo: ["example:example@gmail.com"]
|
|
644
|
+
* })
|
|
645
|
+
* @returns Return email affected
|
|
646
|
+
*/
|
|
592
647
|
setEmailForwarding(domain: string, params: Omit<SetDNSEmailForwardingParams, "domainName">): Promise<string>;
|
|
648
|
+
/**
|
|
649
|
+
* Sets DNS host records settings for the requested domain.
|
|
650
|
+
* @note If you set more than 10 hosts the request will be done by POST method otherwise by GET method.
|
|
651
|
+
* @note All host records that are not included into the API call will be deleted, so add them in addition to new host records.
|
|
652
|
+
* @param {string} sld
|
|
653
|
+
* @param {string} tld
|
|
654
|
+
* @param {Omit<
|
|
655
|
+
* SetDNSHostsParams,
|
|
656
|
+
* "sld" | "tld" | "address" | "hostname" | "mxpref" | "recordType" | "ttl"
|
|
657
|
+
* > & { hosts: Array<Host> }} params Host record configuration object:
|
|
658
|
+
* - emailType?: The type of email service to use.
|
|
659
|
+
* - MXE: to set up your custom MXE record.
|
|
660
|
+
* - MX: to set up custom MX records of your mail provider.
|
|
661
|
+
* - FWD: to set up MX records for our Free Email Forwarding service.
|
|
662
|
+
* - OX: to set up MX records for our Private Email service.
|
|
663
|
+
* - flag?: Is an unsigned integer between 0 and 255. The flag value is an 8-bit number, the most significant bit of which indicates the criticality of understanding of a record by a CA. It's recommended to use `0`
|
|
664
|
+
* - tag?: A non-zero sequence of US-ASCII letters and numbers in lower case. The tag value can be one of the following values:
|
|
665
|
+
* - issue — specifies the certification authority that is authorized to issue a certificate for the domain name or subdomain record used in the title.
|
|
666
|
+
* - issuewild — specifies the certification authority that is allowed to issue a wildcard certificate for the domain name or subdomain record used in the title. The certificate applies to the domain name or subdomain directly and to all its subdomains.
|
|
667
|
+
* - iodef — specifies the e-mail address or URL (compliant with RFC 5070) a CA should use to notify a client if any issuance policy violation spotted by this CA.
|
|
668
|
+
* - hosts: Array with host properties
|
|
669
|
+
* - hostname: Sub-domain/hostname to create the record for
|
|
670
|
+
* - recordType: Record type to that host, possible values
|
|
671
|
+
* - A
|
|
672
|
+
* - AAAA
|
|
673
|
+
* - ALIAS
|
|
674
|
+
* - CAA
|
|
675
|
+
* - CNAME
|
|
676
|
+
* - MX
|
|
677
|
+
* - MXE
|
|
678
|
+
* - NS
|
|
679
|
+
* - TXT
|
|
680
|
+
* - URL
|
|
681
|
+
* - URL301
|
|
682
|
+
* - FRAME
|
|
683
|
+
* - address: The value for this parameter is based on RecordType. Possible values:
|
|
684
|
+
* - URL
|
|
685
|
+
* - IP address
|
|
686
|
+
* - mxpref?: MX preference for host. Applicable for MX records only.
|
|
687
|
+
* - ttl?: Time to live for all record types.
|
|
688
|
+
* @returns Return host list affected
|
|
689
|
+
*/
|
|
593
690
|
setHosts(sld: string, tld: string, params: Omit<SetDNSHostsParams, "sld" | "tld" | "address" | "hostname" | "mxpref" | "recordType" | "ttl"> & {
|
|
594
691
|
hosts: Array<Host>;
|
|
595
692
|
}): Promise<Array<string>>;
|
|
@@ -1141,4 +1238,4 @@ declare class Namecheap {
|
|
|
1141
1238
|
private getConfig;
|
|
1142
1239
|
}
|
|
1143
1240
|
|
|
1144
|
-
export { DomainListSortBy, DomainListType, DomainTransferListType, DomainTransferSortBy, EmailType, GetAddFundsStatus, IdnCode, LockAction, RecordType, SSLListSortBy, SSLListType, SSLType, UserActionName, UserListFindBy, UserPaymentType, UserProductCategory, UserProductName, UserProductType, WhoIsListType, Namecheap as default };
|
|
1241
|
+
export { DomainDnsTag, DomainListSortBy, DomainListType, DomainTransferListType, DomainTransferSortBy, EmailType, GetAddFundsStatus, IdnCode, LockAction, RecordType, SSLListSortBy, SSLListType, SSLType, UserActionName, UserListFindBy, UserPaymentType, UserProductCategory, UserProductName, UserProductType, WhoIsListType, Namecheap as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -465,6 +465,12 @@ declare const GetAddFundsStatus: {
|
|
|
465
465
|
readonly Expired: "EXPIRED";
|
|
466
466
|
};
|
|
467
467
|
type GetAddFundsStatus = (typeof GetAddFundsStatus)[keyof typeof GetAddFundsStatus];
|
|
468
|
+
declare const DomainDnsTag: {
|
|
469
|
+
Issue: string;
|
|
470
|
+
IssueWild: string;
|
|
471
|
+
IODEF: string;
|
|
472
|
+
};
|
|
473
|
+
type DomainDnsTag = (typeof DomainDnsTag)[keyof typeof DomainDnsTag];
|
|
468
474
|
|
|
469
475
|
interface GetListParams$1 {
|
|
470
476
|
listType?: DomainListType;
|
|
@@ -573,7 +579,7 @@ interface SetDNSHostsParams {
|
|
|
573
579
|
tld: string;
|
|
574
580
|
emailType?: EmailType;
|
|
575
581
|
flag?: number;
|
|
576
|
-
tag?:
|
|
582
|
+
tag?: DomainDnsTag;
|
|
577
583
|
hostname: Array<string>;
|
|
578
584
|
ttl: Array<number>;
|
|
579
585
|
address: Array<string>;
|
|
@@ -583,13 +589,104 @@ interface SetDNSHostsParams {
|
|
|
583
589
|
|
|
584
590
|
declare class DomainsDNS {
|
|
585
591
|
private readonly config;
|
|
592
|
+
/**
|
|
593
|
+
* @constructor initial configuration to use global settings
|
|
594
|
+
* @param {NamecheapProps} config Namecheap credentials
|
|
595
|
+
*/
|
|
586
596
|
constructor(config: NamecheapProps);
|
|
597
|
+
/**
|
|
598
|
+
* Sets domain to use our default DNS servers.
|
|
599
|
+
* Required for free services like Host record management, URL forwarding, email forwarding, dynamic dns and other value added services.
|
|
600
|
+
* @param {string} sld SLD of the DomainName
|
|
601
|
+
* @param {string} tld TLD of the DomainName
|
|
602
|
+
* @returns {Promise<>string>} Returns the domain name that you are trying to set default nameservers for.
|
|
603
|
+
*/
|
|
587
604
|
setDefault(sld: string, tld: string): Promise<string>;
|
|
605
|
+
/**
|
|
606
|
+
* Sets domain to use custom DNS servers.
|
|
607
|
+
* @note Services like URL forwarding, Email forwarding, Dynamic DNS will not work for domains using custom nameservers
|
|
608
|
+
* @param {string} sld SLD of the DomainName
|
|
609
|
+
* @param {string} tld TLD of the DomainName
|
|
610
|
+
* @param {Array<string>} nameservers A list of name servers to be associated with this domain
|
|
611
|
+
* @returns {Promise<string>} Returns the domain name that you are trying to set custom nameservers for.
|
|
612
|
+
*/
|
|
588
613
|
setCustom(sld: string, tld: string, nameservers: Array<string>): Promise<string>;
|
|
614
|
+
/**
|
|
615
|
+
* Gets a list of DNS servers associated with the requested domain.
|
|
616
|
+
* @param {string} sld SLD of the DomainName
|
|
617
|
+
* @param {string} tld TLD of the DomainName
|
|
618
|
+
* @returns List of DNS info (see {@link DomainDnsGetListResult})
|
|
619
|
+
*/
|
|
589
620
|
getList(sld: string, tld: string): Promise<DomainDnsGetListResult>;
|
|
621
|
+
/**
|
|
622
|
+
* Retrieves DNS host record settings for the requested domain.
|
|
623
|
+
* @param {string} sld SLD of the DomainName
|
|
624
|
+
* @param {string} tld TLD of the DomainName
|
|
625
|
+
* @returns DNS host records info (see {@link DomainDnsGetHostsResult})
|
|
626
|
+
*/
|
|
590
627
|
getHosts(sld: string, tld: string): Promise<DomainDnsGetHostsResult>;
|
|
628
|
+
/**
|
|
629
|
+
* Gets email forwarding settings for the requested domain.
|
|
630
|
+
* @param {string} domain Domain name to get settings
|
|
631
|
+
* @returns Email forwarding info (see {@link DomainDnsGetEmailForwardingResult})
|
|
632
|
+
*/
|
|
591
633
|
getEmailForwarding(domain: string): Promise<DomainDnsGetEmailForwardingResult>;
|
|
634
|
+
/**
|
|
635
|
+
* Sets email forwarding for a domain name.
|
|
636
|
+
* @param {string} domain Domain name to set settings
|
|
637
|
+
* @param {SetDNSEmailForwardingParams} params Set mailbox and forwards
|
|
638
|
+
* - mailBox: for which you wish to set email forwarding.
|
|
639
|
+
* - forwardTo: Email address to forward to
|
|
640
|
+
* @example
|
|
641
|
+
* setEmailForwarding("mydomain.com", {
|
|
642
|
+
* mailBox: ["example@namecheap.com"],
|
|
643
|
+
* forwardTo: ["example:example@gmail.com"]
|
|
644
|
+
* })
|
|
645
|
+
* @returns Return email affected
|
|
646
|
+
*/
|
|
592
647
|
setEmailForwarding(domain: string, params: Omit<SetDNSEmailForwardingParams, "domainName">): Promise<string>;
|
|
648
|
+
/**
|
|
649
|
+
* Sets DNS host records settings for the requested domain.
|
|
650
|
+
* @note If you set more than 10 hosts the request will be done by POST method otherwise by GET method.
|
|
651
|
+
* @note All host records that are not included into the API call will be deleted, so add them in addition to new host records.
|
|
652
|
+
* @param {string} sld
|
|
653
|
+
* @param {string} tld
|
|
654
|
+
* @param {Omit<
|
|
655
|
+
* SetDNSHostsParams,
|
|
656
|
+
* "sld" | "tld" | "address" | "hostname" | "mxpref" | "recordType" | "ttl"
|
|
657
|
+
* > & { hosts: Array<Host> }} params Host record configuration object:
|
|
658
|
+
* - emailType?: The type of email service to use.
|
|
659
|
+
* - MXE: to set up your custom MXE record.
|
|
660
|
+
* - MX: to set up custom MX records of your mail provider.
|
|
661
|
+
* - FWD: to set up MX records for our Free Email Forwarding service.
|
|
662
|
+
* - OX: to set up MX records for our Private Email service.
|
|
663
|
+
* - flag?: Is an unsigned integer between 0 and 255. The flag value is an 8-bit number, the most significant bit of which indicates the criticality of understanding of a record by a CA. It's recommended to use `0`
|
|
664
|
+
* - tag?: A non-zero sequence of US-ASCII letters and numbers in lower case. The tag value can be one of the following values:
|
|
665
|
+
* - issue — specifies the certification authority that is authorized to issue a certificate for the domain name or subdomain record used in the title.
|
|
666
|
+
* - issuewild — specifies the certification authority that is allowed to issue a wildcard certificate for the domain name or subdomain record used in the title. The certificate applies to the domain name or subdomain directly and to all its subdomains.
|
|
667
|
+
* - iodef — specifies the e-mail address or URL (compliant with RFC 5070) a CA should use to notify a client if any issuance policy violation spotted by this CA.
|
|
668
|
+
* - hosts: Array with host properties
|
|
669
|
+
* - hostname: Sub-domain/hostname to create the record for
|
|
670
|
+
* - recordType: Record type to that host, possible values
|
|
671
|
+
* - A
|
|
672
|
+
* - AAAA
|
|
673
|
+
* - ALIAS
|
|
674
|
+
* - CAA
|
|
675
|
+
* - CNAME
|
|
676
|
+
* - MX
|
|
677
|
+
* - MXE
|
|
678
|
+
* - NS
|
|
679
|
+
* - TXT
|
|
680
|
+
* - URL
|
|
681
|
+
* - URL301
|
|
682
|
+
* - FRAME
|
|
683
|
+
* - address: The value for this parameter is based on RecordType. Possible values:
|
|
684
|
+
* - URL
|
|
685
|
+
* - IP address
|
|
686
|
+
* - mxpref?: MX preference for host. Applicable for MX records only.
|
|
687
|
+
* - ttl?: Time to live for all record types.
|
|
688
|
+
* @returns Return host list affected
|
|
689
|
+
*/
|
|
593
690
|
setHosts(sld: string, tld: string, params: Omit<SetDNSHostsParams, "sld" | "tld" | "address" | "hostname" | "mxpref" | "recordType" | "ttl"> & {
|
|
594
691
|
hosts: Array<Host>;
|
|
595
692
|
}): Promise<Array<string>>;
|
|
@@ -1141,4 +1238,4 @@ declare class Namecheap {
|
|
|
1141
1238
|
private getConfig;
|
|
1142
1239
|
}
|
|
1143
1240
|
|
|
1144
|
-
export { DomainListSortBy, DomainListType, DomainTransferListType, DomainTransferSortBy, EmailType, GetAddFundsStatus, IdnCode, LockAction, RecordType, SSLListSortBy, SSLListType, SSLType, UserActionName, UserListFindBy, UserPaymentType, UserProductCategory, UserProductName, UserProductType, WhoIsListType, Namecheap as default };
|
|
1241
|
+
export { DomainDnsTag, DomainListSortBy, DomainListType, DomainTransferListType, DomainTransferSortBy, EmailType, GetAddFundsStatus, IdnCode, LockAction, RecordType, SSLListSortBy, SSLListType, SSLType, UserActionName, UserListFindBy, UserPaymentType, UserProductCategory, UserProductName, UserProductType, WhoIsListType, Namecheap as default };
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{XMLParser as B}from"fast-xml-parser";import{camelCase as M,pascalCase as H}from"change-case-all";var g=r=>{if(Array.isArray(r))return r.map(g).filter(e=>e!=null&&e!=="");if(typeof r=="object"&&r!==null){let e=Object.keys(r);if(e.length===2&&e.includes("#text")&&e.some(s=>s!=="#text"&&r[s]===!0))return r["#text"];if(e.length===2&&e.some(s=>r[s]===!0)){let s=e.find(a=>r[a]!==!0);return g(r[s])}return Object.keys(r).reduce((s,a)=>{let o=a==="#text"?"value":a,n=g(r[a]);return n!=null&&n!==""&&(s[o]=n),s},{})}return r};var U=r=>`https://${r?"api.sandbox.namecheap.com":"api.namecheap.com"}/xml.response`,x=r=>r.status==="ERROR"||Object.hasOwnProperty.call(r,"errors"),h=(r,e="",s=!0)=>{let a=[];return Object.entries(r).forEach(([o,n])=>{let i=H(`${e} ${o}`);typeof n=="object"&&n!==null&&!Array.isArray(n)?a.push(...h(n,i)):typeof n=="object"&&n!==null&&Array.isArray(n)?n.forEach((m,p)=>{s?a.push([`${i}[${p+1}]`,String(m)]):a.push([`${i}${p+1}`,String(m)])}):n!=null&&a.push([i,String(n)])}),a},X=["apiResponse.commandResponse.tlds.tld","apiResponse.commandResponse.tlds.tld.categories","apiResponse.commandResponse.domainGetListResult.domain","apiResponse.commandResponse.domainCheckResult","apiResponse.commandResponse.userGetPricingResult.productType.productCategory","apiResponse.commandResponse.userGetPricingResult.productType.productCategory.product","apiResponse.commandResponse.userGetPricingResult.productType.productCategory.product.price","apiResponse.commandResponse.whoisguardGetListResult.whoisguardGetListResult.whoisguard","apiResponse.commandResponse.domainDnsGetEmailForwardingResult.forward","apiResponse.commandResponse.domainDnsSetHostsResult"],b=new B({allowBooleanAttributes:!0,attributeNamePrefix:"",ignoreAttributes:!1,processEntities:!0,parseTagValue:!0,parseAttributeValue:!0,trimValues:!0,isArray:(r,e)=>X.includes(e),transformTagName:r=>M(r),transformAttributeName:r=>M(r)});async function t(r,e,s={}){let{apiUser:a,apiKey:o,apiUrl:n,username:i,clientIp:m}=r,p=new URL(n);p.searchParams.append("ApiUser",a),p.searchParams.append("ApiKey",o),p.searchParams.append("UserName",i),p.searchParams.append("ClientIp",m),p.searchParams.append("Command",e),h(s).forEach(([l,N])=>{p.searchParams.append(l,N)});let c=await fetch(p.toString());if(!c.ok)throw new Error(`Error in API Namecheap: ${c.statusText}`);let d=await c.text(),f=b.parse(d),u=g(f.apiResponse);if(x(u)){let l=u.errors;throw{code:l.number||-1,message:l.value||"Unknown Error"}}return u}async function y(r,e,s={},a={}){let{apiUser:o,apiKey:n,apiUrl:i,username:m,clientIp:p}=r,c=new URL(i);c.searchParams.append("ApiUser",o),c.searchParams.append("ApiKey",n),c.searchParams.append("UserName",m),c.searchParams.append("ClientIp",p),c.searchParams.append("Command",e);let d=[];h(s).forEach(([R,G])=>{c.searchParams.append(R,G)}),h(a,"",!1).forEach(([R,G])=>{d.push({Key:R,Value:G})});let f={request:{RequestValues:d}},u=await fetch(c.toString(),{method:"POST",body:JSON.stringify(f)});if(!u.ok)throw new Error(`Error in API Namecheap: ${u.statusText}`);let l=await u.text(),N=b.parse(l),C=g(N.apiResponse);if(x(C)){let R=C.errors;throw{code:R.number,message:R.value}}return C}var z={A:"A",AAAA:"AAAA",ALIAS:"ALIAS",CAA:"CAA",CNAME:"CNAME",MX:"MX",MXE:"MXE",NS:"NS",TXT:"TXT",URL:"URL",URL301:"URL301",FRAME:"FRAME"},j={MXE:"MXE",MX:"MX",FWD:"FWD",OX:"OX"},k={Lock:"LOCK",Unlock:"UNLOCK"},v={All:"ALL",Expiring:"EXPIRING",Expired:"EXPIRED"},J={NameAsc:"NAME",NameDesc:"NAME_DESC",ExpireDateAsc:"EXPIREDATE",ExpireDateDesc:"EXPIREDATE_DESC",CreateDateAsc:"CREATEDATE",CreateDateDesc:"CREATEDATE_DESC"},Y={AFR:"afr",ALB:"alb",ARA:"ara",ARG:"arg",ARM:"arm",ASM:"asm",AST:"ast",AVE:"ave",AWA:"awa",AZE:"aze",BAK:"bak",BAL:"bal",BAN:"ban",BAQ:"baq",BAS:"bas",BEL:"bel",BEN:"ben",BHO:"bho",BOS:"bos",BUL:"bul",BUR:"bur",CAR:"car",CAT:"cat",CHE:"che",CHI:"chi",CHV:"chv",COP:"cop",COS:"cos",CZE:"cze",DAN:"dan",DIV:"div",DOI:"doi",DUT:"dut",ENG:"eng",EST:"est",FAO:"fao",FIJ:"fij",FIN:"fin",FRE:"fre",FRY:"fry",GEO:"geo",GER:"ger",GLA:"gla",GLE:"gle",GON:"gon",GRE:"gre",GUJ:"guj",HEB:"heb",HIN:"hin",HUN:"hun",INC:"inc",IND:"ind",INH:"inh",ISL:"isl",ITA:"ita",JAV:"jav",JPN:"jpn",KAS:"kas",KAZ:"kaz",KHM:"khm",KIR:"kir",KOR:"kor",KUR:"kur",LAO:"lao",LAV:"lav",LIT:"lit",LTZ:"ltz",MAL:"mal",MKD:"mkd",MLT:"mlt",MOL:"mol",MON:"mon",MRI:"mri",MSA:"msa",NEP:"nep",NOR:"nor",ORI:"ori",OSS:"oss",PAN:"pan",PER:"per",POL:"pol",POR:"por",PUS:"pus",RAJ:"raj",RUM:"rum",RUS:"rus",SAN:"san",SCR:"scr",SIN:"sin",SLO:"slo",SLV:"slv",SMO:"smo",SND:"snd",SOM:"som",SPA:"spa",SRD:"srd",SRP:"srp",SWA:"swa",SWE:"swe",SYR:"syr",TAM:"tam",TEL:"tel",TGK:"tgk",THA:"tha",TIB:"tib",TUR:"tur",UKR:"ukr",URD:"urd",UZB:"uzb",VIE:"vie",WEL:"wel",YID:"yid"},F={All:"ALL",InProgress:"INPROGRESS",Cancelled:"CANCELLED",Completed:"COMPLETED"},O={DomainName:"DOMAINNAME",DomainNameDesc:"DOMAINNAME_DESC",TransferDate:"TRANSFERDATE",TransferDateDesc:"TRANSFERDATE_DESC",StatusDate:"STATUSDATE",StatusDateDesc:"STATUSDATE_DESC"},Z={PositiveSSL:"PositiveSSL",EssentialSSL:"EssentialSSL",InstantSSL:"InstantSSL",InstantSSLPro:"InstantSSL Pro",PremiumSSL:"PremiumSSL",EVSSL:"EV SSL",PositiveSSLWildcard:"PositiveSSL Wildcard",EssentialSSLWildcard:"EssentialSSL Wildcard",PremiumSSLWildcard:"PremiumSSL Wildcard",PositiveSSLMultiDomain:"PositiveSSL Multi Domain",MultiDomainSSL:"Multi Domain SSL",UnifiedCommunications:"Unified Communications",EVMultiDomainSSL:"EV Multi Domain SSL"},Q={ALL:"ALL",Processing:"Processing",EmailSent:"EmailSent",TechnicalProblem:"TechnicalProblem",InProgress:"InProgress",Completed:"Completed",Deactivated:"Deactivated",Active:"Active",Cancelled:"Cancelled",NewPurchase:"NewPurchase",NewRenewal:"NewRenewal"},ee={PurchaseDate:"PURCHASEDATE",PurchaseDateDesc:"PURCHASEDATE_DESC",SSLType:"SSLTYPE",SSLTypeDesc:"SSLTYPE_DESC",ExpireDateTime:"EXPIREDATETIME",ExpireDateTimeDesc:"EXPIREDATETIME_DESC",Hostname:"Host_Name",HostnameDesc:"Host_Name_DESC"},se={Domain:"DOMAIN",SslCertificate:"SSLCERTIFICATE"},te={Domains:"DOMAINS",Comodo:"COMODO"},ae={Register:"REGISTER",Renew:"RENEW",Reactivate:"REACTIVATE",Transfer:"TRANSFER",Purchase:"PURCHASE"},re={COM:"COM",InstantSsl:"INSTANTSSL"},ne={CreditCard:"Creditcard"},oe={EmailAddress:"EMAILADDRESS",DomainName:"DOMAINNAME",Username:"USERNAME"},ie={All:"ALL",Alloted:"ALLOTED",Free:"FREE",Discard:"DISCARD"},pe={Created:"CREATED",Submitted:"SUBMITTED",Completed:"COMPLETED",Failed:"FAILED",Expired:"EXPIRED"};var S=class{constructor(e){this.config=e}async getList(e={listType:v.All,page:1,pageSize:20}){let s=await t(this.config,"namecheap.domains.getList",e);return{data:s.commandResponse.domainGetListResult,paging:s.commandResponse.paging}}async getContacts(e){return(await t(this.config,"namecheap.domains.getContacts",{domainName:e})).commandResponse.domainContactsResult}async create(e,s){return(await t(this.config,"namecheap.domains.create",{...s,domainName:e})).commandResponse.domainCreateResult}async getTldList(){return(await t(this.config,"namecheap.domains.getTldList")).commandResponse.tlds}async setContacts(e,s){return(await t(this.config,"namecheap.domains.setContacts",{...s,domainName:e})).commandResponse.domainSetContactResult}async check(e){return(await t(this.config,"namecheap.domains.check",{domainList:e.join()})).commandResponse.domainCheckResult}async reactivate(e,s={}){return(await t(this.config,"namecheap.domains.reactivate",{...s,domainName:e})).commandResponse.domainReactivateResult}async renew(e,s){return(await t(this.config,"namecheap.domains.renew",{...s,domainName:e})).commandResponse.domainRenewResult}async getRegistrarLock(e){return(await t(this.config,"namecheap.domains.getRegistrarLock",{domainName:e})).commandResponse.domainGetRegistrarLockResult}async setRegistrarLock(e,s={lockAction:k.Lock}){return(await t(this.config,"namecheap.domains.setRegistrarLock",{...s,domainName:e})).commandResponse.domainSetRegistrarLockResult}async getInfo(e,s){return(await t(this.config,"namecheap.domains.getInfo",{domainName:e,hostName:s})).commandResponse.domainGetInfoResult}};var P=class{constructor(e){this.config=e}async setDefault(e,s){return(await t(this.config,"namecheap.domains.dns.setDefault",{sld:e,tld:s})).commandResponse.domainDnsSetDefaultResult}async setCustom(e,s,a){return(await t(this.config,"namecheap.domains.dns.setCustom",{sld:e,tld:s,nameservers:a})).commandResponse.domainDNSSetCustomResult}async getList(e,s){return(await t(this.config,"namecheap.domains.dns.getList",{sld:e,tld:s})).commandResponse.domainDnsGetListResult}async getHosts(e,s){return(await t(this.config,"namecheap.domains.dns.getHosts",{sld:e,tld:s})).commandResponse.domainDnsGetHostsResult}async getEmailForwarding(e){return(await t(this.config,"namecheap.domains.dns.getEmailForwarding",{domainName:e})).commandResponse.domainDnsGetEmailForwardingResult}async setEmailForwarding(e,s){return(await t(this.config,"namecheap.domains.dns.setEmailForwarding",{...s,domainName:e})).commandResponse.domainDnsSetEmailForwardingResult}async setHosts(e,s,a){let{hosts:o}=a,n=o.reduce((m,p,c)=>(Object.entries(p).forEach(([d,f])=>{m[d][c]=f}),m),{hostname:[],ttl:[],address:[],mxpref:[],recordType:[]}),i;return o.length>10?i=await y(this.config,"namecheap.domains.dns.setHosts",{SLD:e,TLD:s},{...n,tag:a.tag,flag:a.flag,emailType:a.emailType}):i=await t(this.config,"namecheap.domains.dns.setHosts",{...n,sld:e,tld:s,tag:a.tag,flag:a.flag,emailType:a.emailType}),i.commandResponse.domainDnsSetHostsResult}};var L=class{constructor(e){this.config=e}async create(e,s,a,o){return(await t(this.config,"namecheap.domains.ns.create",{sld:e,tld:s,nameserver:a,ip:o})).commandResponse.domainNsCreateResult}async delete(e,s,a){return(await t(this.config,"namecheap.domains.ns.delete",{sld:e,tld:s,nameserver:a})).commandResponse.domainNsDeleteResult}async getInfo(e,s,a){return(await t(this.config,"namecheap.domains.ns.getInfo",{sld:e,tld:s,nameserver:a})).commandResponse.domainNsInfoResult}async update(e,s,a,o,n){return(await t(this.config,"namecheap.domains.ns.update",{sld:e,tld:s,nameserver:a,ip:o,oldIp:n})).commandResponse.domainNsUpdateResult}};var A=class{constructor(e){this.config=e}async create(e,s){return(await t(this.config,"namecheap.domains.transfer.create",{domainName:e,...s})).commandResponse.domainTransferCreateResult}async getStatus(e){return(await t(this.config,"namecheap.domains.transfer.getStatus",{transferID:e})).commandResponse.domainTransferGetStatusResult}async updateStatus(e,s){return(await t(this.config,"namecheap.domains.transfer.updateStatus",{transferID:e,resubmit:s})).commandResponse.domainTransferUpdateStatusResult}async getList(e={listType:F.All,page:1,pageSize:10,sortBy:O.DomainName}){let s=await t(this.config,"namecheap.domains.transfer.getList",e);return{data:s.commandResponse.transferGetListResult,paging:s.commandResponse.paging}}};var D=class{constructor(e){this.config=e}async create(e){return(await t(this.config,"namecheap.ssl.create",e)).commandResponse.sslCreateResult}async getList(e){return(await t(this.config,"namecheap.ssl.getList",e)).commandResponse.sslListResult}async parseCSR(e,s){return(await y(this.config,"namecheap.ssl.parseCSR",{csr:e,certificateType:s})).commandResponse.sslParseCsrResult}async getApproverEmailList(e,s){return(await t(this.config,"namecheap.ssl.getApproverEmailList",{domainName:e,certificateType:s})).commandResponse.getApproverEmailListResult}async activate(e,s){return(await t(this.config,"namecheap.ssl.activate",{certificateId:e,...s})).commandResponse.sslActivateResult}async resendApproverEmail(e){return(await t(this.config,"namecheap.ssl.resendApproverEmail",{certificateId:e})).commandResponse.sslResendApproverEmailResult}async getInfo(e){return(await t(this.config,"namecheap.ssl.getInfo",{certificateId:e})).commandResponse.sslGetInfoResult}async renew(e,s){return(await t(this.config,"namecheap.ssl.renew",{certificateId:e,...s})).commandResponse.sslRenewResult}async reissue(e,s){return(await t(this.config,"namecheap.ssl.reissue",{certificateId:e,...s})).commandResponse.sslActivateResult}async resendFulfillmentEmail(e){return(await t(this.config,"namecheap.ssl.resendfulfillmentemail",{certificateId:e})).commandResponse.sslResendFulfillmentEmailResult}async purchaseMoreSANS(e,s){return(await t(this.config,"namecheap.ssl.purchasemoresans",{certificateId:e,numberOfSANSToAdd:s})).commandResponse.sslPurchaseMoreSansResult}async revokeCertificate(e,s){return(await t(this.config,"namecheap.ssl.revokecertificate",{certificateId:e,certificateType:s})).commandResponse.revokeCertificateResult}async editDCVMethod(e,s){return(await t(this.config,"namecheap.ssl.editDCVMethod",{certificateId:e,...s})).commandResponse.sslEditDcvMethodResult}};var E=class{constructor(e){this.config=e}async getPricing(e){return(await t(this.config,"namecheap.users.getPricing",e)).commandResponse.userGetPricingResult}async getBalances(){return(await t(this.config,"namecheap.users.getBalances")).commandResponse.userGetBalancesResult}async changePassword(e,s){return(await t(this.config,"namecheap.users.changePassword",{oldPassword:e,newPassword:s})).commandResponse.userChangePasswordResult}async update(e){return(await t(this.config,"namecheap.users.update",e)).commandResponse.userUpdateResult}async createAddFundsRequest(e,s){return(await t(this.config,"namecheap.users.createaddfundsrequest",{...s,username:e})).commandResponse.createaddfundsrequestresult}async getAddFundsStatus(e){return(await t(this.config,"namecheap.users.getAddFundsStatus",{tokenId:e})).commandResponse.getAddFundsStatusResult}async create(e){return(await t(this.config,"namecheap.users.create",e)).commandResponse.userCreateResult}async login(e){return(await t(this.config,"namecheap.users.login",{password:e})).commandResponse.userLoginResult}async resetPassword(e){return(await t(this.config,"namecheap.users.resetPassword",e)).commandResponse.userResetPasswordResult}};var T=class{constructor(e){this.config=e}async create(e){return(await t(this.config,"namecheap.users.address.create",e)).commandResponse.addressCreateResult}async delete(e){return(await t(this.config,"namecheap.users.address.delete",{addressId:e})).commandResponse.addressDeleteResult}async getInfo(e){return(await t(this.config,"namecheap.users.address.getInfo",{addressId:e})).commandResponse.getAddressInfoResult}async getList(){return(await t(this.config,"namecheap.users.address.getList")).commandResponse.addressGetListResult}async setDefault(e){return(await t(this.config,"namecheap.users.address.setDefault",{addressId:e})).commandResponse.addressSetDefaultResult}async update(e,s){return(await t(this.config,"namecheap.users.address.update",{...s,addressId:e})).commandResponse.addressUpdateResult}};var w=class{constructor(e){this.config=e}async changeEmailAddress(e){return(await t(this.config,"namecheap.whoisguard.changeemailaddress",{whoIsGuardId:e})).commandResponse.whoisguardChangeEmailAddressResult}async enable(e,s){return(await t(this.config,"namecheap.whoisguard.enable",{whoIsGuardId:e,forwardedToEmail:s})).commandResponse.whoisguardEnableResult}async disable(e){return(await t(this.config,"namecheap.whoisguard.disable",{whoIsGuardId:e})).commandResponse.whoisguardDisableResult}async getList(e){let s=await t(this.config,"namecheap.whoisguard.getList",e);return{data:s.commandResponse.whoisguardGetListResult,paging:s.commandResponse.paging}}async renew(e,s,a){return(await t(this.config,"namecheap.whoisguard.renew",{whoIsGuardId:e,year:s,promotionCode:a})).commandResponse.whoisguardRenewResult}};var I=class{get domainPrivacy(){return this.whoIsGuard}constructor(e){let{apiUser:s,apiKey:a,username:o,clientIp:n,sandbox:i}=e;this.apiUser=s,this.apiKey=a,this.username=o||s,this.clientIp=n,this.apiUrl=U(i),this.domains=new S(this.getConfig()),this.domainsDns=new P(this.getConfig()),this.domainsNs=new L(this.getConfig()),this.domainsTransfer=new A(this.getConfig()),this.ssl=new D(this.getConfig()),this.users=new E(this.getConfig()),this.usersAddress=new T(this.getConfig()),this.whoIsGuard=new w(this.getConfig())}getConfig(){return{apiUser:this.apiUser,apiKey:this.apiKey,username:this.username,clientIp:this.clientIp,apiUrl:this.apiUrl}}};export{J as DomainListSortBy,v as DomainListType,F as DomainTransferListType,O as DomainTransferSortBy,j as EmailType,pe as GetAddFundsStatus,Y as IdnCode,k as LockAction,z as RecordType,ee as SSLListSortBy,Q as SSLListType,Z as SSLType,ae as UserActionName,oe as UserListFindBy,ne as UserPaymentType,te as UserProductCategory,re as UserProductName,se as UserProductType,ie as WhoIsListType,I as default};
|
|
1
|
+
import{XMLParser as B}from"fast-xml-parser";import{camelCase as M,pascalCase as H}from"change-case-all";var g=r=>{if(Array.isArray(r))return r.map(g).filter(e=>e!=null&&e!=="");if(typeof r=="object"&&r!==null){let e=Object.keys(r);if(e.length===2&&e.includes("#text")&&e.some(s=>s!=="#text"&&r[s]===!0))return r["#text"];if(e.length===2&&e.some(s=>r[s]===!0)){let s=e.find(a=>r[a]!==!0);return g(r[s])}return Object.keys(r).reduce((s,a)=>{let o=a==="#text"?"value":a,n=g(r[a]);return n!=null&&n!==""&&(s[o]=n),s},{})}return r};var U=r=>`https://${r?"api.sandbox.namecheap.com":"api.namecheap.com"}/xml.response`,x=r=>r.status==="ERROR"||Object.hasOwnProperty.call(r,"errors"),h=(r,e="",s=!0)=>{let a=[];return Object.entries(r).forEach(([o,n])=>{let i=H(`${e} ${o}`);typeof n=="object"&&n!==null&&!Array.isArray(n)?a.push(...h(n,i)):typeof n=="object"&&n!==null&&Array.isArray(n)?n.forEach((m,p)=>{s?a.push([`${i}[${p+1}]`,String(m)]):a.push([`${i}${p+1}`,String(m)])}):n!=null&&a.push([i,String(n)])}),a},X=["apiResponse.commandResponse.tlds.tld","apiResponse.commandResponse.tlds.tld.categories","apiResponse.commandResponse.domainGetListResult.domain","apiResponse.commandResponse.domainCheckResult","apiResponse.commandResponse.userGetPricingResult.productType.productCategory","apiResponse.commandResponse.userGetPricingResult.productType.productCategory.product","apiResponse.commandResponse.userGetPricingResult.productType.productCategory.product.price","apiResponse.commandResponse.whoisguardGetListResult.whoisguardGetListResult.whoisguard","apiResponse.commandResponse.domainDnsGetEmailForwardingResult.forward","apiResponse.commandResponse.domainDnsSetHostsResult"],b=new B({allowBooleanAttributes:!0,attributeNamePrefix:"",ignoreAttributes:!1,processEntities:!0,parseTagValue:!0,parseAttributeValue:!0,trimValues:!0,isArray:(r,e)=>X.includes(e),transformTagName:r=>M(r),transformAttributeName:r=>M(r)});async function t(r,e,s={}){let{apiUser:a,apiKey:o,apiUrl:n,username:i,clientIp:m}=r,p=new URL(n);p.searchParams.append("ApiUser",a),p.searchParams.append("ApiKey",o),p.searchParams.append("UserName",i),p.searchParams.append("ClientIp",m),p.searchParams.append("Command",e),h(s).forEach(([l,N])=>{p.searchParams.append(l,N)});let c=await fetch(p.toString());if(!c.ok)throw new Error(`Error in API Namecheap: ${c.statusText}`);let d=await c.text(),f=b.parse(d),u=g(f.apiResponse);if(x(u)){let l=u.errors;throw{code:l.number||-1,message:l.value||"Unknown Error"}}return u}async function y(r,e,s={},a={}){let{apiUser:o,apiKey:n,apiUrl:i,username:m,clientIp:p}=r,c=new URL(i);c.searchParams.append("ApiUser",o),c.searchParams.append("ApiKey",n),c.searchParams.append("UserName",m),c.searchParams.append("ClientIp",p),c.searchParams.append("Command",e);let d=[];h(s).forEach(([R,G])=>{c.searchParams.append(R,G)}),h(a,"",!1).forEach(([R,G])=>{d.push({Key:R,Value:G})});let f={request:{RequestValues:d}},u=await fetch(c.toString(),{method:"POST",body:JSON.stringify(f)});if(!u.ok)throw new Error(`Error in API Namecheap: ${u.statusText}`);let l=await u.text(),N=b.parse(l),C=g(N.apiResponse);if(x(C)){let R=C.errors;throw{code:R.number,message:R.value}}return C}var z={A:"A",AAAA:"AAAA",ALIAS:"ALIAS",CAA:"CAA",CNAME:"CNAME",MX:"MX",MXE:"MXE",NS:"NS",TXT:"TXT",URL:"URL",URL301:"URL301",FRAME:"FRAME"},j={MXE:"MXE",MX:"MX",FWD:"FWD",OX:"OX"},k={Lock:"LOCK",Unlock:"UNLOCK"},v={All:"ALL",Expiring:"EXPIRING",Expired:"EXPIRED"},J={NameAsc:"NAME",NameDesc:"NAME_DESC",ExpireDateAsc:"EXPIREDATE",ExpireDateDesc:"EXPIREDATE_DESC",CreateDateAsc:"CREATEDATE",CreateDateDesc:"CREATEDATE_DESC"},Y={AFR:"afr",ALB:"alb",ARA:"ara",ARG:"arg",ARM:"arm",ASM:"asm",AST:"ast",AVE:"ave",AWA:"awa",AZE:"aze",BAK:"bak",BAL:"bal",BAN:"ban",BAQ:"baq",BAS:"bas",BEL:"bel",BEN:"ben",BHO:"bho",BOS:"bos",BUL:"bul",BUR:"bur",CAR:"car",CAT:"cat",CHE:"che",CHI:"chi",CHV:"chv",COP:"cop",COS:"cos",CZE:"cze",DAN:"dan",DIV:"div",DOI:"doi",DUT:"dut",ENG:"eng",EST:"est",FAO:"fao",FIJ:"fij",FIN:"fin",FRE:"fre",FRY:"fry",GEO:"geo",GER:"ger",GLA:"gla",GLE:"gle",GON:"gon",GRE:"gre",GUJ:"guj",HEB:"heb",HIN:"hin",HUN:"hun",INC:"inc",IND:"ind",INH:"inh",ISL:"isl",ITA:"ita",JAV:"jav",JPN:"jpn",KAS:"kas",KAZ:"kaz",KHM:"khm",KIR:"kir",KOR:"kor",KUR:"kur",LAO:"lao",LAV:"lav",LIT:"lit",LTZ:"ltz",MAL:"mal",MKD:"mkd",MLT:"mlt",MOL:"mol",MON:"mon",MRI:"mri",MSA:"msa",NEP:"nep",NOR:"nor",ORI:"ori",OSS:"oss",PAN:"pan",PER:"per",POL:"pol",POR:"por",PUS:"pus",RAJ:"raj",RUM:"rum",RUS:"rus",SAN:"san",SCR:"scr",SIN:"sin",SLO:"slo",SLV:"slv",SMO:"smo",SND:"snd",SOM:"som",SPA:"spa",SRD:"srd",SRP:"srp",SWA:"swa",SWE:"swe",SYR:"syr",TAM:"tam",TEL:"tel",TGK:"tgk",THA:"tha",TIB:"tib",TUR:"tur",UKR:"ukr",URD:"urd",UZB:"uzb",VIE:"vie",WEL:"wel",YID:"yid"},F={All:"ALL",InProgress:"INPROGRESS",Cancelled:"CANCELLED",Completed:"COMPLETED"},O={DomainName:"DOMAINNAME",DomainNameDesc:"DOMAINNAME_DESC",TransferDate:"TRANSFERDATE",TransferDateDesc:"TRANSFERDATE_DESC",StatusDate:"STATUSDATE",StatusDateDesc:"STATUSDATE_DESC"},Z={PositiveSSL:"PositiveSSL",EssentialSSL:"EssentialSSL",InstantSSL:"InstantSSL",InstantSSLPro:"InstantSSL Pro",PremiumSSL:"PremiumSSL",EVSSL:"EV SSL",PositiveSSLWildcard:"PositiveSSL Wildcard",EssentialSSLWildcard:"EssentialSSL Wildcard",PremiumSSLWildcard:"PremiumSSL Wildcard",PositiveSSLMultiDomain:"PositiveSSL Multi Domain",MultiDomainSSL:"Multi Domain SSL",UnifiedCommunications:"Unified Communications",EVMultiDomainSSL:"EV Multi Domain SSL"},Q={ALL:"ALL",Processing:"Processing",EmailSent:"EmailSent",TechnicalProblem:"TechnicalProblem",InProgress:"InProgress",Completed:"Completed",Deactivated:"Deactivated",Active:"Active",Cancelled:"Cancelled",NewPurchase:"NewPurchase",NewRenewal:"NewRenewal"},ee={PurchaseDate:"PURCHASEDATE",PurchaseDateDesc:"PURCHASEDATE_DESC",SSLType:"SSLTYPE",SSLTypeDesc:"SSLTYPE_DESC",ExpireDateTime:"EXPIREDATETIME",ExpireDateTimeDesc:"EXPIREDATETIME_DESC",Hostname:"Host_Name",HostnameDesc:"Host_Name_DESC"},se={Domain:"DOMAIN",SslCertificate:"SSLCERTIFICATE"},te={Domains:"DOMAINS",Comodo:"COMODO"},ae={Register:"REGISTER",Renew:"RENEW",Reactivate:"REACTIVATE",Transfer:"TRANSFER",Purchase:"PURCHASE"},re={COM:"COM",InstantSsl:"INSTANTSSL"},ne={CreditCard:"Creditcard"},oe={EmailAddress:"EMAILADDRESS",DomainName:"DOMAINNAME",Username:"USERNAME"},ie={All:"ALL",Alloted:"ALLOTED",Free:"FREE",Discard:"DISCARD"},pe={Created:"CREATED",Submitted:"SUBMITTED",Completed:"COMPLETED",Failed:"FAILED",Expired:"EXPIRED"},ce={Issue:"issue",IssueWild:"issuewild",IODEF:"iodef"};var S=class{constructor(e){this.config=e}async getList(e={listType:v.All,page:1,pageSize:20}){let s=await t(this.config,"namecheap.domains.getList",e);return{data:s.commandResponse.domainGetListResult,paging:s.commandResponse.paging}}async getContacts(e){return(await t(this.config,"namecheap.domains.getContacts",{domainName:e})).commandResponse.domainContactsResult}async create(e,s){return(await t(this.config,"namecheap.domains.create",{...s,domainName:e})).commandResponse.domainCreateResult}async getTldList(){return(await t(this.config,"namecheap.domains.getTldList")).commandResponse.tlds}async setContacts(e,s){return(await t(this.config,"namecheap.domains.setContacts",{...s,domainName:e})).commandResponse.domainSetContactResult}async check(e){return(await t(this.config,"namecheap.domains.check",{domainList:e.join()})).commandResponse.domainCheckResult}async reactivate(e,s={}){return(await t(this.config,"namecheap.domains.reactivate",{...s,domainName:e})).commandResponse.domainReactivateResult}async renew(e,s){return(await t(this.config,"namecheap.domains.renew",{...s,domainName:e})).commandResponse.domainRenewResult}async getRegistrarLock(e){return(await t(this.config,"namecheap.domains.getRegistrarLock",{domainName:e})).commandResponse.domainGetRegistrarLockResult}async setRegistrarLock(e,s={lockAction:k.Lock}){return(await t(this.config,"namecheap.domains.setRegistrarLock",{...s,domainName:e})).commandResponse.domainSetRegistrarLockResult}async getInfo(e,s){return(await t(this.config,"namecheap.domains.getInfo",{domainName:e,hostName:s})).commandResponse.domainGetInfoResult}};var P=class{constructor(e){this.config=e}async setDefault(e,s){return(await t(this.config,"namecheap.domains.dns.setDefault",{sld:e,tld:s})).commandResponse.domainDnsSetDefaultResult}async setCustom(e,s,a){return(await t(this.config,"namecheap.domains.dns.setCustom",{sld:e,tld:s,nameservers:a})).commandResponse.domainDNSSetCustomResult}async getList(e,s){return(await t(this.config,"namecheap.domains.dns.getList",{sld:e,tld:s})).commandResponse.domainDnsGetListResult}async getHosts(e,s){return(await t(this.config,"namecheap.domains.dns.getHosts",{sld:e,tld:s})).commandResponse.domainDnsGetHostsResult}async getEmailForwarding(e){return(await t(this.config,"namecheap.domains.dns.getEmailForwarding",{domainName:e})).commandResponse.domainDnsGetEmailForwardingResult}async setEmailForwarding(e,s){return(await t(this.config,"namecheap.domains.dns.setEmailForwarding",{...s,domainName:e})).commandResponse.domainDnsSetEmailForwardingResult}async setHosts(e,s,a){let{hosts:o}=a,n=o.reduce((m,p,c)=>(Object.entries(p).forEach(([d,f])=>{m[d][c]=f}),m),{hostname:[],ttl:[],address:[],mxpref:[],recordType:[]}),i;return o.length>10?i=await y(this.config,"namecheap.domains.dns.setHosts",{SLD:e,TLD:s},{...n,tag:a.tag,flag:a.flag,emailType:a.emailType}):i=await t(this.config,"namecheap.domains.dns.setHosts",{...n,sld:e,tld:s,tag:a.tag,flag:a.flag,emailType:a.emailType}),i.commandResponse.domainDnsSetHostsResult}};var L=class{constructor(e){this.config=e}async create(e,s,a,o){return(await t(this.config,"namecheap.domains.ns.create",{sld:e,tld:s,nameserver:a,ip:o})).commandResponse.domainNsCreateResult}async delete(e,s,a){return(await t(this.config,"namecheap.domains.ns.delete",{sld:e,tld:s,nameserver:a})).commandResponse.domainNsDeleteResult}async getInfo(e,s,a){return(await t(this.config,"namecheap.domains.ns.getInfo",{sld:e,tld:s,nameserver:a})).commandResponse.domainNsInfoResult}async update(e,s,a,o,n){return(await t(this.config,"namecheap.domains.ns.update",{sld:e,tld:s,nameserver:a,ip:o,oldIp:n})).commandResponse.domainNsUpdateResult}};var A=class{constructor(e){this.config=e}async create(e,s){return(await t(this.config,"namecheap.domains.transfer.create",{domainName:e,...s})).commandResponse.domainTransferCreateResult}async getStatus(e){return(await t(this.config,"namecheap.domains.transfer.getStatus",{transferID:e})).commandResponse.domainTransferGetStatusResult}async updateStatus(e,s){return(await t(this.config,"namecheap.domains.transfer.updateStatus",{transferID:e,resubmit:s})).commandResponse.domainTransferUpdateStatusResult}async getList(e={listType:F.All,page:1,pageSize:10,sortBy:O.DomainName}){let s=await t(this.config,"namecheap.domains.transfer.getList",e);return{data:s.commandResponse.transferGetListResult,paging:s.commandResponse.paging}}};var D=class{constructor(e){this.config=e}async create(e){return(await t(this.config,"namecheap.ssl.create",e)).commandResponse.sslCreateResult}async getList(e){return(await t(this.config,"namecheap.ssl.getList",e)).commandResponse.sslListResult}async parseCSR(e,s){return(await y(this.config,"namecheap.ssl.parseCSR",{csr:e,certificateType:s})).commandResponse.sslParseCsrResult}async getApproverEmailList(e,s){return(await t(this.config,"namecheap.ssl.getApproverEmailList",{domainName:e,certificateType:s})).commandResponse.getApproverEmailListResult}async activate(e,s){return(await t(this.config,"namecheap.ssl.activate",{certificateId:e,...s})).commandResponse.sslActivateResult}async resendApproverEmail(e){return(await t(this.config,"namecheap.ssl.resendApproverEmail",{certificateId:e})).commandResponse.sslResendApproverEmailResult}async getInfo(e){return(await t(this.config,"namecheap.ssl.getInfo",{certificateId:e})).commandResponse.sslGetInfoResult}async renew(e,s){return(await t(this.config,"namecheap.ssl.renew",{certificateId:e,...s})).commandResponse.sslRenewResult}async reissue(e,s){return(await t(this.config,"namecheap.ssl.reissue",{certificateId:e,...s})).commandResponse.sslActivateResult}async resendFulfillmentEmail(e){return(await t(this.config,"namecheap.ssl.resendfulfillmentemail",{certificateId:e})).commandResponse.sslResendFulfillmentEmailResult}async purchaseMoreSANS(e,s){return(await t(this.config,"namecheap.ssl.purchasemoresans",{certificateId:e,numberOfSANSToAdd:s})).commandResponse.sslPurchaseMoreSansResult}async revokeCertificate(e,s){return(await t(this.config,"namecheap.ssl.revokecertificate",{certificateId:e,certificateType:s})).commandResponse.revokeCertificateResult}async editDCVMethod(e,s){return(await t(this.config,"namecheap.ssl.editDCVMethod",{certificateId:e,...s})).commandResponse.sslEditDcvMethodResult}};var E=class{constructor(e){this.config=e}async getPricing(e){return(await t(this.config,"namecheap.users.getPricing",e)).commandResponse.userGetPricingResult}async getBalances(){return(await t(this.config,"namecheap.users.getBalances")).commandResponse.userGetBalancesResult}async changePassword(e,s){return(await t(this.config,"namecheap.users.changePassword",{oldPassword:e,newPassword:s})).commandResponse.userChangePasswordResult}async update(e){return(await t(this.config,"namecheap.users.update",e)).commandResponse.userUpdateResult}async createAddFundsRequest(e,s){return(await t(this.config,"namecheap.users.createaddfundsrequest",{...s,username:e})).commandResponse.createaddfundsrequestresult}async getAddFundsStatus(e){return(await t(this.config,"namecheap.users.getAddFundsStatus",{tokenId:e})).commandResponse.getAddFundsStatusResult}async create(e){return(await t(this.config,"namecheap.users.create",e)).commandResponse.userCreateResult}async login(e){return(await t(this.config,"namecheap.users.login",{password:e})).commandResponse.userLoginResult}async resetPassword(e){return(await t(this.config,"namecheap.users.resetPassword",e)).commandResponse.userResetPasswordResult}};var T=class{constructor(e){this.config=e}async create(e){return(await t(this.config,"namecheap.users.address.create",e)).commandResponse.addressCreateResult}async delete(e){return(await t(this.config,"namecheap.users.address.delete",{addressId:e})).commandResponse.addressDeleteResult}async getInfo(e){return(await t(this.config,"namecheap.users.address.getInfo",{addressId:e})).commandResponse.getAddressInfoResult}async getList(){return(await t(this.config,"namecheap.users.address.getList")).commandResponse.addressGetListResult}async setDefault(e){return(await t(this.config,"namecheap.users.address.setDefault",{addressId:e})).commandResponse.addressSetDefaultResult}async update(e,s){return(await t(this.config,"namecheap.users.address.update",{...s,addressId:e})).commandResponse.addressUpdateResult}};var w=class{constructor(e){this.config=e}async changeEmailAddress(e){return(await t(this.config,"namecheap.whoisguard.changeemailaddress",{whoIsGuardId:e})).commandResponse.whoisguardChangeEmailAddressResult}async enable(e,s){return(await t(this.config,"namecheap.whoisguard.enable",{whoIsGuardId:e,forwardedToEmail:s})).commandResponse.whoisguardEnableResult}async disable(e){return(await t(this.config,"namecheap.whoisguard.disable",{whoIsGuardId:e})).commandResponse.whoisguardDisableResult}async getList(e){let s=await t(this.config,"namecheap.whoisguard.getList",e);return{data:s.commandResponse.whoisguardGetListResult,paging:s.commandResponse.paging}}async renew(e,s,a){return(await t(this.config,"namecheap.whoisguard.renew",{whoIsGuardId:e,year:s,promotionCode:a})).commandResponse.whoisguardRenewResult}};var I=class{get domainPrivacy(){return this.whoIsGuard}constructor(e){let{apiUser:s,apiKey:a,username:o,clientIp:n,sandbox:i}=e;this.apiUser=s,this.apiKey=a,this.username=o||s,this.clientIp=n,this.apiUrl=U(i),this.domains=new S(this.getConfig()),this.domainsDns=new P(this.getConfig()),this.domainsNs=new L(this.getConfig()),this.domainsTransfer=new A(this.getConfig()),this.ssl=new D(this.getConfig()),this.users=new E(this.getConfig()),this.usersAddress=new T(this.getConfig()),this.whoIsGuard=new w(this.getConfig())}getConfig(){return{apiUser:this.apiUser,apiKey:this.apiKey,username:this.username,clientIp:this.clientIp,apiUrl:this.apiUrl}}};export{ce as DomainDnsTag,J as DomainListSortBy,v as DomainListType,F as DomainTransferListType,O as DomainTransferSortBy,j as EmailType,pe as GetAddFundsStatus,Y as IdnCode,k as LockAction,z as RecordType,ee as SSLListSortBy,Q as SSLListType,Z as SSLType,ae as UserActionName,oe as UserListFindBy,ne as UserPaymentType,te as UserProductCategory,re as UserProductName,se as UserProductType,ie as WhoIsListType,I as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|