@fwgapps/namecheap 0.2.1 → 0.3.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.
package/README.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @fwgapps/namecheap
2
2
 
3
+ <!-- STATUS -->
4
+ [![CI/CD Pipeline](https://github.com/fwgapps/namecheap/actions/workflows/publish.yml/badge.svg)](https://github.com/fwgapps/namecheap/actions/workflows/publish.yml)
5
+ [![Codecov](https://codecov.io/gh/fwgapps/namecheap/branch/main/graph/badge.svg)](https://codecov.io/gh/fwgapps/namecheap)
6
+ ![Maintenance](https://img.shields.io/maintenance/yes/2025)
7
+
8
+ <!-- NPM -->
9
+ [![npm](https://img.shields.io/npm/v/@fwgapps/namecheap)](https://www.npmjs.com/package/@fwgapps/namecheap)
10
+ ![npm downloads](https://img.shields.io/npm/dm/@fwgapps/namecheap)
11
+ [![bundlephobia](https://img.shields.io/bundlephobia/minzip/@fwgapps/namecheap)](https://bundlephobia.com/result?p=@fwgapps/namecheap)
12
+ [![dependencies](https://img.shields.io/librariesio/release/npm/@fwgapps/namecheap)](https://libraries.io/npm/@fwgapps/namecheap)
13
+
14
+ <!-- META -->
15
+ ![license](https://img.shields.io/npm/l/@fwgapps/namecheap)
16
+ ![TypeScript](https://img.shields.io/badge/typescript-%233178C6.svg?logo=typescript)
17
+ ![issues](https://img.shields.io/github/issues/fwgapps/namecheap)
18
+ ![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)
19
+
3
20
  A simple and efficient TypeScript library for interacting with the Namecheap API, returning structured JSON responses.
4
21
 
5
22
  ## Table of Contents
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var M=Object.defineProperty;var k=Object.getOwnPropertyDescriptor;var O=Object.getOwnPropertyNames;var q=Object.prototype.hasOwnProperty;var H=(r,e)=>{for(var s in e)M(r,s,{get:e[s],enumerable:!0})},V=(r,e,s,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of O(e))!q.call(r,o)&&o!==s&&M(r,o,{get:()=>e[o],enumerable:!(a=k(e,o))||a.enumerable});return r};var X=r=>V(M({},"__esModule",{value:!0}),r);var B={};H(B,{default:()=>C});module.exports=X(B);var v=require("fast-xml-parser"),f=require("change-case-all");var R=r=>{if(Array.isArray(r))return r.map(R).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 R(r[s])}return Object.keys(r).reduce((s,a)=>{let o=a==="#text"?"value":a,n=R(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"),P=(r,e="",s=!0)=>{let a=[];return Object.entries(r).forEach(([o,n])=>{let i=(0,f.pascalCase)(`${e} ${o}`);typeof n=="object"&&n!==null&&!Array.isArray(n)?a.push(...P(n,i)):typeof n=="object"&&n!==null&&Array.isArray(n)?n.forEach((c,p)=>{s?a.push([`${i}[${p+1}]`,String(c)]):a.push([`${i}${p+1}`,String(c)])}):n!=null&&a.push([i,String(n)])}),a},K=["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"],F=new v.XMLParser({allowBooleanAttributes:!0,attributeNamePrefix:"",ignoreAttributes:!1,processEntities:!0,parseTagValue:!0,parseAttributeValue:!0,trimValues:!0,isArray:(r,e)=>K.includes(e),transformTagName:r=>(0,f.camelCase)(r),transformAttributeName:r=>(0,f.camelCase)(r)});async function t(r,e,s={}){let{apiUser:a,apiKey:o,apiUrl:n,username:i,clientIp:c}=r,p=new URL(n);p.searchParams.append("ApiUser",a),p.searchParams.append("ApiKey",o),p.searchParams.append("UserName",i),p.searchParams.append("ClientIp",c),p.searchParams.append("Command",e),P(s).forEach(([l,T])=>{p.searchParams.append(l,T)});let m=await fetch(p.toString());if(!m.ok)throw new Error(`Error in API Namecheap: ${m.statusText}`);let d=await m.text(),h=F.parse(d),u=R(h.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:c,clientIp:p}=r,m=new URL(i);m.searchParams.append("ApiUser",o),m.searchParams.append("ApiKey",n),m.searchParams.append("UserName",c),m.searchParams.append("ClientIp",p),m.searchParams.append("Command",e);let d=[];P(s).forEach(([g,I])=>{m.searchParams.append(g,I)}),P(a,"",!1).forEach(([g,I])=>{d.push({Key:g,Value:I})});let h={request:{RequestValues:d}},u=await fetch(m.toString(),{method:"POST",body:JSON.stringify(h)});if(!u.ok)throw new Error(`Error in API Namecheap: ${u.statusText}`);let l=await u.text(),T=F.parse(l),b=R(T.apiResponse);if(x(b)){let g=b.errors;throw{code:g.number,message:g.value}}return b}var w=class{constructor(e){this.config=e}async getList(e={listType:"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:"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",{...s,domainName:e})).commandResponse.domainGetInfoResult}};var S=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((c,p,m)=>(Object.entries(p).forEach(([d,h])=>{c[d][m]=h}),c),{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 G=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:"ALL",page:1,pageSize:10,sortBy:"DOMAINNAME"}){let s=await t(this.config,"namecheap.domains.transfer.getList",e);return{data:s.commandResponse.transferGetListResult,paging:s.commandResponse.paging}}};var A=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 N=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 D=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 E=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 C=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 w(this.getConfig()),this.domainsDns=new S(this.getConfig()),this.domainsNs=new L(this.getConfig()),this.domainsTransfer=new G(this.getConfig()),this.ssl=new A(this.getConfig()),this.users=new N(this.getConfig()),this.usersAddress=new D(this.getConfig()),this.whoIsGuard=new E(this.getConfig())}getConfig(){return{apiUser:this.apiUser,apiKey:this.apiKey,username:this.username,clientIp:this.clientIp,apiUrl:this.apiUrl}}};
1
+ "use strict";var U=Object.defineProperty;var X=Object.getOwnPropertyDescriptor;var V=Object.getOwnPropertyNames;var q=Object.prototype.hasOwnProperty;var K=(r,e)=>{for(var s in e)U(r,s,{get:e[s],enumerable:!0})},W=(r,e,s,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of V(e))!q.call(r,o)&&o!==s&&U(r,o,{get:()=>e[o],enumerable:!(a=X(e,o))||a.enumerable});return r};var _=r=>W(U({},"__esModule",{value:!0}),r);var ce={};K(ce,{DomainListSortBy:()=>J,DomainListType:()=>b,DomainTransferListType:()=>k,DomainTransferSortBy:()=>v,EmailType:()=>j,GetAddFundsStatus:()=>pe,IdnCode:()=>Y,LockAction:()=>x,RecordType:()=>z,SSLListSortBy:()=>ee,SSLListType:()=>Q,SSLType:()=>Z,UserActionName:()=>ae,UserListFindBy:()=>oe,UserPaymentType:()=>ne,UserProductCategory:()=>te,UserProductName:()=>re,UserProductType:()=>se,WhoIsListType:()=>ie,default:()=>C});module.exports=_(ce);var F=require("fast-xml-parser"),h=require("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 O=r=>`https://${r?"api.sandbox.namecheap.com":"api.namecheap.com"}/xml.response`,B=r=>r.status==="ERROR"||Object.hasOwnProperty.call(r,"errors"),y=(r,e="",s=!0)=>{let a=[];return Object.entries(r).forEach(([o,n])=>{let i=(0,h.pascalCase)(`${e} ${o}`);typeof n=="object"&&n!==null&&!Array.isArray(n)?a.push(...y(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},$=["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"],H=new F.XMLParser({allowBooleanAttributes:!0,attributeNamePrefix:"",ignoreAttributes:!1,processEntities:!0,parseTagValue:!0,parseAttributeValue:!0,trimValues:!0,isArray:(r,e)=>$.includes(e),transformTagName:r=>(0,h.camelCase)(r),transformAttributeName:r=>(0,h.camelCase)(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),y(s).forEach(([l,G])=>{p.searchParams.append(l,G)});let c=await fetch(p.toString());if(!c.ok)throw new Error(`Error in API Namecheap: ${c.statusText}`);let d=await c.text(),f=H.parse(d),u=g(f.apiResponse);if(B(u)){let l=u.errors;throw{code:l.number||-1,message:l.value||"Unknown Error"}}return u}async function S(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=[];y(s).forEach(([R,M])=>{c.searchParams.append(R,M)}),y(a,"",!1).forEach(([R,M])=>{d.push({Key:R,Value:M})});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(),G=H.parse(l),I=g(G.apiResponse);if(B(I)){let R=I.errors;throw{code:R.number,message:R.value}}return I}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"},x={Lock:"LOCK",Unlock:"UNLOCK"},b={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"},k={All:"ALL",InProgress:"INPROGRESS",Cancelled:"CANCELLED",Completed:"COMPLETED"},v={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 P=class{constructor(e){this.config=e}async getList(e={listType:b.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:x.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 L=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 S(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 A=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 D=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:k.All,page:1,pageSize:10,sortBy:v.DomainName}){let s=await t(this.config,"namecheap.domains.transfer.getList",e);return{data:s.commandResponse.transferGetListResult,paging:s.commandResponse.paging}}};var E=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 S(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 T=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 w=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 N=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 C=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=O(i),this.domains=new P(this.getConfig()),this.domainsDns=new L(this.getConfig()),this.domainsNs=new A(this.getConfig()),this.domainsTransfer=new D(this.getConfig()),this.ssl=new E(this.getConfig()),this.users=new T(this.getConfig()),this.usersAddress=new w(this.getConfig()),this.whoIsGuard=new N(this.getConfig())}getConfig(){return{apiUser:this.apiUser,apiKey:this.apiKey,username:this.username,clientIp:this.clientIp,apiUrl:this.apiUrl}}};0&&(module.exports={DomainListSortBy,DomainListType,DomainTransferListType,DomainTransferSortBy,EmailType,GetAddFundsStatus,IdnCode,LockAction,RecordType,SSLListSortBy,SSLListType,SSLType,UserActionName,UserListFindBy,UserPaymentType,UserProductCategory,UserProductName,UserProductType,WhoIsListType});
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/utils/service.ts","../src/utils/xml.ts","../src/methods/domains/index.ts","../src/methods/domains/dns.ts","../src/methods/domains/ns.ts","../src/methods/domains/transfer.ts","../src/methods/ssl/index.ts","../src/methods/users/index.ts","../src/methods/users/address.ts","../src/methods/whois-guard/index.ts"],"sourcesContent":["import {ConfigType, type NamecheapProps} from \"./types/config.type\";\nimport {getNamecheapHost} from \"./utils/service\";\nimport {Domains} from \"./methods/domains\";\nimport {DomainsDNS} from \"@fwg/methods/domains/dns\";\nimport {DomainsNS} from \"@fwg/methods/domains/ns\";\nimport {DomainsTransfer} from \"@fwg/methods/domains/transfer\";\nimport {SSL} from \"@fwg/methods/ssl\";\nimport {Users} from \"@fwg/methods/users\";\nimport {UsersAddress} from \"@fwg/methods/users/address\";\nimport {WhoIsGuard} from \"src/methods/whois-guard\";\n\nexport default class Namecheap {\n private readonly apiUrl: string;\n private readonly apiUser: string;\n private readonly apiKey: string;\n private readonly username: string;\n private readonly clientIp: string;\n\n public readonly domains: Domains;\n public readonly domainsDns: DomainsDNS;\n public readonly domainsNs: DomainsNS;\n public readonly domainsTransfer: DomainsTransfer;\n\n public readonly ssl: SSL;\n\n public readonly users: Users;\n public readonly usersAddress: UsersAddress;\n public readonly whoIsGuard: WhoIsGuard;\n\n public get domainPrivacy(): WhoIsGuard {\n return this.whoIsGuard\n }\n\n constructor(\n config: ConfigType\n ) {\n const {apiUser, apiKey, username, clientIp, sandbox} = config;\n\n this.apiUser = apiUser;\n this.apiKey = apiKey;\n this.username = username || apiUser;\n this.clientIp = clientIp;\n this.apiUrl = getNamecheapHost(sandbox);\n\n this.domains = new Domains(this.getConfig());\n this.domainsDns = new DomainsDNS(this.getConfig());\n this.domainsNs = new DomainsNS(this.getConfig());\n this.domainsTransfer = new DomainsTransfer(this.getConfig());\n this.ssl = new SSL(this.getConfig());\n this.users = new Users(this.getConfig());\n this.usersAddress = new UsersAddress(this.getConfig());\n this.whoIsGuard = new WhoIsGuard(this.getConfig());\n }\n\n private getConfig(): NamecheapProps {\n return {\n apiUser: this.apiUser,\n apiKey: this.apiKey,\n username: this.username,\n clientIp: this.clientIp,\n apiUrl: this.apiUrl\n }\n }\n}","import { XMLParser } from \"fast-xml-parser\";\nimport { camelCase, pascalCase } from \"change-case-all\";\nimport { simplifyObject } from \"./xml\";\nimport type { NamecheapProps } from \"../types/config.type\";\nimport {\n NamecheapXMLParsedBase,\n NamecheapXMLParsedFail,\n NamecheapXMLParsedSuccess,\n RequestValues\n} from \"../types/methods/base.type\";\nimport {\n MappedResponseSuccess,\n NamecheapParamsMap,\n NamecheapPostParamsMap,\n NamecheapRootParamsMap\n} from \"../types/methods/mapped.type\";\n\n/**\n * Generates the URL for the Namecheap API endpoint based on the environment.\n *\n * @param {boolean} isSandbox - Determines whether to use the sandbox environment.\n * If true, the sandbox URL is returned; otherwise, the production URL is returned.\n * @returns {string} The fully constructed URL for the Namecheap API endpoint.\n */\nexport const getNamecheapHost = (isSandbox: boolean): string => {\n const host = !isSandbox ? \"api.namecheap.com\" : \"api.sandbox.namecheap.com\";\n return `https://${host}/xml.response`;\n};\n\n/**\n * Determines if a request response contains an error.\n *\n * This function evaluates the provided response object to check whether\n * it indicates an error. An error is identified if the \"status\" property\n * of the response is equal to \"ERROR\" or if the response object contains\n * an \"errors\" property.\n *\n * @param {NamecheapXMLParsedBase | NamecheapXMLParsedFail} response - The parsed response object to evaluate.\n * @returns {boolean} True if the response indicates an error, otherwise false.\n */\nconst checkRequestError = (response: NamecheapXMLParsedBase | NamecheapXMLParsedFail): boolean => response.status === \"ERROR\" || Object.hasOwnProperty.call(response, \"errors\")\n\n/**\n * Flattens a nested object into an array of key-value pairs where the keys are\n * transformed to a PascalCase format, optionally prefixed by a given string.\n *\n * @param {Record<string, any>} input - The object to be flattened. This can be a deeply nested object.\n * @param {string} [prefix=\"\"] - An optional prefix to be added to each key in the flattened structure.\n * @returns {Array<[string, string]>} An array of key-value pairs where each key is in PascalCase,\n * and values are converted to strings.\n */\n/* eslint-disable */\nconst flattenObjectToArray = (input: Record<string, any>, prefix: string = \"\", arrayFormat = true): Array<[string, string]> => {\n const result: Array<[string, string]> = [];\n\n Object.entries(input).forEach(([key, value]) => {\n const capitalizedKey = pascalCase(`${prefix} ${key}`);\n\n if (typeof value === \"object\" && value !== null && !Array.isArray(value)) {\n result.push(...flattenObjectToArray(value, capitalizedKey));\n } else if (typeof value === \"object\" && value !== null && Array.isArray(value)) {\n value.forEach((item, index) => {\n if(arrayFormat){\n result.push([`${capitalizedKey}[${index + 1}]`, String(item)]);\n } else {\n result.push([`${capitalizedKey}${index + 1}`, String(item)]);\n }\n })\n } else if (value !== undefined && value !== null) {\n result.push([capitalizedKey, String(value)]);\n }\n });\n\n return result;\n}\n\n/**\n * An array containing strings that represent specific paths or structures\n * in an API response object. Each string corresponds to a key or nested\n * property within a JSON response, typically used for accessing or mapping\n * data within the response object. These paths can represent different\n * data points like top-level domains (TLDs), domain categories, or domain\n * check results.\n */\nconst tagNamesArray = [\n \"apiResponse.commandResponse.tlds.tld\",\n \"apiResponse.commandResponse.tlds.tld.categories\",\n \"apiResponse.commandResponse.domainGetListResult.domain\",\n \"apiResponse.commandResponse.domainCheckResult\",\n \"apiResponse.commandResponse.userGetPricingResult.productType.productCategory\",\n \"apiResponse.commandResponse.userGetPricingResult.productType.productCategory.product\",\n \"apiResponse.commandResponse.userGetPricingResult.productType.productCategory.product.price\",\n \"apiResponse.commandResponse.whoisguardGetListResult.whoisguardGetListResult.whoisguard\"\n];\n\n/**\n * Configuration object for the XMLParser instance.\n *\n**/\nconst parser = new XMLParser({\n allowBooleanAttributes: true,\n attributeNamePrefix: \"\",\n ignoreAttributes: false,\n processEntities: true,\n parseTagValue: true,\n parseAttributeValue: true,\n trimValues: true,\n isArray: (_tagName, jPath) => {\n return tagNamesArray.includes(jPath);\n },\n transformTagName: (tagName) => camelCase(tagName),\n transformAttributeName: (attributeName) => camelCase(attributeName),\n});\n\n/**\n * Sends a request to the Namecheap API, constructs the query parameters using the provided properties,\n * and parses the XML response into JSON.\n *\n * @param {NamecheapProps} namecheapProps An object containing authentication and configuration details for the Namecheap API.\n * @param {T} command The specific API command to be executed.\n * @param {NamecheapParamsMap[T]} [params={}] Additional parameters required for the specific API command.\n * @return {Promise<NamecheapXMLParsedSuccess<MappedDomain[T]>>} The parsed JSON response representing the successful result of the API request.\n * @throws {Error} Throws an error if the API response status is not OK or if the API returns a failure response.\n */\nexport async function request<T extends keyof MappedResponseSuccess>(\n namecheapProps: NamecheapProps, \n command: T,\n params: NamecheapParamsMap[T] = {} as NamecheapParamsMap[T]\n): Promise<NamecheapXMLParsedSuccess<MappedResponseSuccess[T]>> {\n const { apiUser, apiKey, apiUrl, username, clientIp} = namecheapProps;\n\n let url = new URL(apiUrl);\n url.searchParams.append(\"ApiUser\", apiUser);\n url.searchParams.append(\"ApiKey\", apiKey);\n url.searchParams.append(\"UserName\", username);\n url.searchParams.append(\"ClientIp\", clientIp);\n url.searchParams.append(\"Command\", command);\n\n flattenObjectToArray(params).forEach(([key, value]) => {\n url.searchParams.append(key, value)\n })\n\n const response = await fetch(url.toString());\n\n if (!response.ok) {\n throw new Error(`Error in API Namecheap: ${response.statusText}`);\n }\n\n const xmlData = await response.text();\n\n // await response.text();\n const parsedValue: { apiResponse: MappedResponseSuccess[T] } = parser.parse(xmlData);\n const json: NamecheapXMLParsedBase = simplifyObject(parsedValue.apiResponse);\n\n if(checkRequestError(json)){\n const error = (json as NamecheapXMLParsedFail).errors;\n throw {\n code: error.number || -1,\n message: error.value || \"Unknown Error\"\n }\n }\n\n return json as NamecheapXMLParsedSuccess<MappedResponseSuccess[T]>\n}\n\nexport async function requestPost<T extends keyof MappedResponseSuccess>(\n namecheapProps: NamecheapProps,\n command: T,\n rootParams: NamecheapRootParamsMap[T] = {} as NamecheapRootParamsMap[T],\n params: NamecheapPostParamsMap[T] = {} as NamecheapPostParamsMap[T]\n): Promise<NamecheapXMLParsedSuccess<MappedResponseSuccess[T]>> {\n const { apiUser, apiKey, apiUrl, username, clientIp} = namecheapProps;\n\n let url = new URL(apiUrl);\n url.searchParams.append(\"ApiUser\", apiUser);\n url.searchParams.append(\"ApiKey\", apiKey);\n url.searchParams.append(\"UserName\", username);\n url.searchParams.append(\"ClientIp\", clientIp);\n url.searchParams.append(\"Command\", command);\n\n const requestValues: Array<RequestValues> = [];\n\n flattenObjectToArray(rootParams).forEach(([key, value]) => {\n url.searchParams.append(key, value)\n })\n\n flattenObjectToArray(params, \"\", false).forEach(([key, value]) => {\n requestValues.push({\n Key: key,\n Value: value\n })\n })\n\n\n const body = {\n request: {\n RequestValues: requestValues\n }\n }\n\n const response = await fetch(url.toString(), {\n method: \"POST\",\n body: JSON.stringify(body),\n });\n\n if (!response.ok) {\n throw new Error(`Error in API Namecheap: ${response.statusText}`);\n }\n\n const xmlData = await response.text();\n const parsedValue: { apiResponse: MappedResponseSuccess[T] } = parser.parse(xmlData);\n const json: NamecheapXMLParsedBase = simplifyObject(parsedValue.apiResponse);\n\n if(checkRequestError(json)){\n const error = (json as NamecheapXMLParsedFail).errors;\n throw {\n code: error.number,\n message: error.value\n }\n }\n\n return json as NamecheapXMLParsedSuccess<MappedResponseSuccess[T]>\n}","/**\n * Simplifies a complex object by recursively processing its structure.\n * This function performs the following transformations:\n * - For arrays, it simplifies each element and filters out null, undefined, or empty string values.\n * - For objects with specific keys and conditions:\n * - If the object contains exactly two keys, one named `\"#text\"` and another key with a boolean value of `true`,\n * the function extracts and returns the value of the `\"#text\"` key.\n * - If the object contains exactly two keys, with one key holding a boolean value of `true`,\n * the function simplifies the value associated with the other key.\n * - For general objects, it renames the `\"#text\"` key to `value` and simplifies all properties recursively.\n * Null, undefined, and empty string properties are excluded from the resulting object.\n * - For other types (primitive values), the value is returned as-is.\n *\n * @param {any} obj - The object or value to simplify.\n * @returns {any} - The simplified object or value.\n */\nexport const simplifyObject = (obj: any): any => {\n if (Array.isArray(obj)) {\n return obj\n .map(simplifyObject)\n .filter(item => item !== null && item !== undefined && item !== \"\");\n } else if (typeof obj === \"object\" && obj !== null) {\n const keys = Object.keys(obj);\n\n if (\n keys.length === 2 &&\n keys.includes(\"#text\") &&\n keys.some(key => key !== \"#text\" && obj[key] === true)\n ) {\n return obj[\"#text\"];\n }\n\n if (\n keys.length === 2 &&\n keys.some(key => obj[key] === true)\n ) {\n const keyWithValue = keys.find(key => obj[key] !== true);\n return simplifyObject(obj[keyWithValue!]);\n }\n\n return Object.keys(obj).reduce((acc, key) => {\n const newKey = key === \"#text\" ? \"value\" : key;\n const simplifiedValue = simplifyObject(obj[key]);\n\n if (simplifiedValue !== null && simplifiedValue !== undefined && simplifiedValue !== \"\") {\n acc[newKey] = simplifiedValue;\n }\n\n return acc;\n }, {} as Record<string, any>);\n }\n\n return obj;\n};\n","import { NamecheapProps } from \"@fwg/types/config.type\";\nimport { request } from \"@fwg/utils/service\";\nimport { CommandsDomain } from \"@fwg/utils/commands\";\nimport {\n DomainCheckResult,\n DomainContactsResult,\n DomainCreateResult, DomainGetInfoResult,\n DomainGetListResult, DomainGetRegistrarLockResult,\n DomainReactivateResult, DomainRenewResult, DomainSetRegistrarLockResult,\n TLD\n} from \"@fwg/types/methods/response/domains.type\";\nimport type {\n ContactDomainParams,\n CreateDomainParams, GetInfoParams, GetListParams,\n ReactivateDomainParams,\n RenewDomainParams,\n SetRegistrarLockParams\n} from \"@fwg/types/methods/params/domains-params.type\";\nimport {Paging} from \"@fwg/types/methods/base.type\";\n\n/**\n * The `Domains` class provides methods to interact with domain-related functionalities\n * using the Namecheap API. It allows performing operations such as retrieving domain lists,\n * managing contacts, checking availability, and managing domain statuses.\n */\nexport class Domains {\n private readonly config: NamecheapProps;\n\n constructor(config: NamecheapProps) {\n this.config = config;\n }\n\n /**\n * Retrieves a list of domains or related items based on the specified parameters.\n *\n * @param {Object} params - The parameters to configure the list retrieval.\n * @param {string} [params.listType=\"ALL\"] - The type of list to retrieve (e.g., ALL, EXPIRING, etc.).\n * @param {number} [params.page=1] - The page number of the results to retrieve.\n * @param {number} [params.pageSize=20] - The number of items to retrieve per page.\n * @return {Promise<NamecheapXMLParsedSuccess<GetListSuccess>>} A promise that resolves with the parsed response data.\n */\n async getList(params: GetListParams = {\n listType: \"ALL\",\n page: 1,\n pageSize: 20\n }): Promise<{\n data: Array<DomainGetListResult>;\n paging: Paging\n }> {\n const response = await request(this.config, CommandsDomain.GetList, params);\n return {\n data: response.commandResponse.domainGetListResult,\n paging: response.commandResponse.paging\n }\n }\n\n /**\n * Retrieves the contact information associated with the given domain name.\n *\n * @param {string} domainName - The domain name for which to retrieve contact information.\n * @return {Promise<NamecheapXMLParsedSuccess<GetContactSuccess>>} A promise that resolves with the parsed response containing the contact details.\n */\n async getContacts(domainName: string): Promise<DomainContactsResult> {\n const response = await request(this.config, CommandsDomain.GetContact, {\n domainName\n });\n return response.commandResponse.domainContactsResult\n }\n\n /**\n * Creates a new domain registration with the provided parameters.\n *\n * @param {string} domain - The domain name to be created.\n * @param {Omit<CreateDomainParams, \"domainName\">} params - The parameters required for domain creation, excluding the domain name.\n * @return {Promise<NamecheapXMLParsedSuccess<CreateSuccess>>} A promise that resolves with the result of the domain creation process.\n */\n async create(domain: string, params: Omit<CreateDomainParams, \"domainName\">): Promise<DomainCreateResult> {\n const response = await request(this.config, CommandsDomain.Create, {\n ...params,\n domainName: domain\n });\n\n return response.commandResponse.domainCreateResult\n }\n\n /**\n * Retrieves the list of top-level domains (TLDs) available from the Namecheap API.\n *\n * @return {Promise<NamecheapXMLParsedSuccess<GetTldListSuccess>>} A promise that resolves with the structured response data containing the details of available TLDs.\n */\n async getTldList(): Promise<Array<TLD>>{\n const response = await request(this.config, CommandsDomain.GetTldList)\n return response.commandResponse.tlds;\n }\n\n /**\n * Updates the contact details for a specific domain.\n *\n * @param {string} domain - The domain name for which the contact information will be updated.\n * @param {Omit<ContactDomainParams, \"domainName\">} params - The contact information to set, omitting the domain name property.\n * @return {Promise<NamecheapXMLParsedSuccess<SetContactSuccess>>} A promise that resolves to the result of the contact update operation.\n */\n async setContacts(domain: string, params: Omit<ContactDomainParams, \"domainName\">): Promise<string> {\n const response = await request(this.config, CommandsDomain.SetContact, {\n ...params,\n domainName: domain,\n });\n\n return response.commandResponse.domainSetContactResult\n }\n\n /**\n * Checks the availability of the given list of domains.\n *\n * @param {Array<string>} domains - An array of domain names to check for availability.\n * @return {Promise<NamecheapXMLParsedSuccess<CheckSuccess>>} A promise that resolves to the parsed response indicating the availability status of each domain.\n */\n async check(domains: Array<string>): Promise<DomainCheckResult>{\n const response = await request(this.config, CommandsDomain.Check, {\n domainList: domains.join(),\n });\n\n return response.commandResponse.domainCheckResult;\n }\n\n /**\n * Reactivates a previously expired or deactivated domain.\n *\n * @param {string} domain - The name of the domain to be reactivated.\n * @param {Omit<ReactivateDomainParams, \"domainName\">} [params={}] - Additional parameters for reactivation, excluding the domain name.\n * @return {Promise<NamecheapXMLParsedSuccess<ReactiveSuccess>>} A promise that resolves with the result of the domain reactivation.\n */\n async reactivate(domain: string, params: Omit<ReactivateDomainParams, \"domainName\"> = {}): Promise<DomainReactivateResult> {\n const response = await request(this.config, CommandsDomain.Reactivate, {\n ...params,\n domainName: domain,\n });\n\n return response.commandResponse.domainReactivateResult\n }\n\n /**\n * Renews the registration of a domain name with the specified parameters.\n *\n * @param {string} domain - The domain name to be renewed.\n * @param {Omit<RenewDomainParams, \"domainName\">} params - The parameters required for renewing the domain, excluding the domain name.\n * @return {Promise<NamecheapXMLParsedSuccess<RenewSuccess>>} A promise that resolves with the parsed response data indicating the success of the renewal.\n */\n async renew(domain: string, params: Omit<RenewDomainParams, \"domainName\">): Promise<DomainRenewResult> {\n const response = await request(this.config, CommandsDomain.Renew, {\n ...params,\n domainName: domain,\n });\n\n return response.commandResponse.domainRenewResult\n }\n\n /**\n * Retrieves the registrar lock status of the specified domain.\n *\n * @param {string} domain - The domain name for which the registrar lock status is being retrieved.\n * @return {Promise<NamecheapXMLParsedSuccess<GetRegistrarLockSuccess>>} A promise that resolves to the parsed success response containing the registrar lock status.\n */\n async getRegistrarLock(domain: string): Promise<DomainGetRegistrarLockResult>{\n const response = await request(this.config, CommandsDomain.GetRegistrarLock, {\n domainName: domain,\n });\n\n return response.commandResponse.domainGetRegistrarLockResult\n }\n\n /**\n * Sets the registrar lock status for a specified domain.\n *\n * @param {string} domain - The domain name for which the registrar lock status is being set.\n * @param {Object} params - Additional configuration options for the registrar lock action.\n * Defaults to `{ lockAction: \"LOCK\" }`. Excludes the \"domainName\" property.\n * @return {Promise<NamecheapXMLParsedSuccess<SetRegistrarLockSuccess>>} A promise that resolves with the parsed response\n * indicating the success or failure of the operation.\n */\n async setRegistrarLock(domain: string, params: Omit<SetRegistrarLockParams, \"domainName\"> = {\n lockAction: \"LOCK\"\n }): Promise<DomainSetRegistrarLockResult>{\n const response = await request(this.config, CommandsDomain.SetRegistrarLock, {\n ...params,\n domainName: domain,\n });\n\n return response.commandResponse.domainSetRegistrarLockResult\n }\n\n /**\n * Retrieves information about a specific domain.\n *\n * @param {string} domain - The domain name for which information is to be retrieved.\n * @param {Omit<GetInfoParams, \"domainName\">} [params={}] - Additional parameters for the request, excluding the domain name.\n * @return {Promise<NamecheapXMLParsedSuccess<GetInfoSuccess>>} A promise that resolves to the parsed response containing domain information.\n */\n async getInfo(domain: string, params: Omit<GetInfoParams, \"domainName\"> = {}): Promise<DomainGetInfoResult>{\n const response = await request(this.config, CommandsDomain.GetInfo, {\n ...params,\n domainName: domain,\n });\n\n return response.commandResponse.domainGetInfoResult\n }\n}\n","import type { NamecheapProps } from \"@fwg/types/config.type\";\nimport {\n DomainDnsGetEmailForwardingResult,\n DomainDnsGetHostsResult,\n DomainDnsGetListResult\n} from \"@fwg/types/methods/response/domains-dns.type\";\nimport {request, requestPost} from \"@fwg/utils/service\";\nimport { CommandsDomainDNS } from \"@fwg/utils/commands\";\nimport {\n Host,\n RecordType,\n SetDNSEmailForwardingParams,\n SetDNSHostsParams\n} from \"@fwg/types/methods/params/domains-dns-params.type\";\n\nexport class DomainsDNS {\n private readonly config: NamecheapProps;\n\n constructor(config: NamecheapProps) {\n this.config = config;\n }\n\n async setDefault(sld: string, tld: string): Promise<string> {\n const response = await request(this.config, CommandsDomainDNS.SetDefault, {\n sld,\n tld\n });\n\n return response.commandResponse.domainDnsSetDefaultResult\n }\n\n async setCustom(sld: string, tld: string, nameservers: Array<string>): Promise<string> {\n const response = await request(this.config, CommandsDomainDNS.SetCustom, {\n sld,\n tld,\n nameservers\n });\n\n return response.commandResponse.domainDNSSetCustomResult\n }\n\n async getList(sld: string, tld: string): Promise<DomainDnsGetListResult> {\n const response = await request(this.config, CommandsDomainDNS.GetList, {\n sld,\n tld,\n });\n\n return response.commandResponse.domainDnsGetListResult\n }\n\n async getHosts(sld: string, tld: string): Promise<DomainDnsGetHostsResult> {\n const response = await request(this.config, CommandsDomainDNS.GetHosts, {\n sld,\n tld,\n });\n\n return response.commandResponse.domainDnsGetHostsResult\n }\n\n async getEmailForwarding(domain: string): Promise<DomainDnsGetEmailForwardingResult> {\n const response = await request(this.config, CommandsDomainDNS.GetEmailForwarding, {\n domainName: domain\n });\n\n return response.commandResponse.domainDnsGetEmailForwardingResult\n }\n\n async setEmailForwarding(\n domain: string,\n params: Omit<SetDNSEmailForwardingParams, \"domainName\">\n ): Promise<string> {\n const response = await request(this.config, CommandsDomainDNS.SetEmailForwarding, {\n ...params,\n domainName: domain\n });\n\n return response.commandResponse.domainDnsSetEmailForwardingResult\n }\n\n async setHosts(\n sld: string,\n tld: string,\n params: Omit<SetDNSHostsParams, \"sld\" | \"tld\"> & { hosts: Array<Host> }\n ): Promise<string> {\n const { hosts } = params;\n const paramsFormatted = hosts.reduce((acc, host, i) => {\n Object.entries(host).forEach(([key, value]) => {\n // @ts-ignore\n acc[key][i] = value\n });\n\n return acc;\n }, {\n hostname: [] as Array<string>,\n ttl: [] as Array<number>,\n address: [] as Array<string>,\n mxpref: [] as Array<string>,\n recordType: [] as Array<RecordType>,\n })\n let response;\n\n if(hosts.length > 10) {\n response = await requestPost(this.config, CommandsDomainDNS.SetHosts, {\n SLD: sld,\n TLD: tld,\n }, {\n ...paramsFormatted,\n tag: params.tag,\n flag: params.flag,\n emailType: params.emailType\n });\n } else {\n response = await request(this.config, CommandsDomainDNS.SetHosts, {\n ...paramsFormatted,\n sld,\n tld,\n tag: params.tag,\n flag: params.flag,\n emailType: params.emailType\n });\n }\n\n return response.commandResponse.domainDnsSetHostsResult\n }\n}\n","import type { NamecheapProps } from \"@fwg/types/config.type\";\nimport { request } from \"@fwg/utils/service\";\nimport { CommandsDomainNS } from \"@fwg/utils/commands\";\nimport {\n DomainNsCreateResult,\n DomainNsDeleteResult,\n DomainNsInfoResult,\n DomainNsUpdateResult,\n} from \"@fwg/types/methods/response/domains-ns.type\";\n\nexport class DomainsNS {\n private readonly config: NamecheapProps;\n\n constructor(config: NamecheapProps) {\n this.config = config;\n }\n\n async create(sld: string, tld: string, nameserver: string, ip: string): Promise<DomainNsCreateResult> {\n const response = await request(this.config, CommandsDomainNS.Create, {\n sld,\n tld,\n nameserver,\n ip\n });\n\n return response.commandResponse.domainNsCreateResult;\n }\n\n async delete(sld: string, tld: string, nameserver: string): Promise<DomainNsDeleteResult> {\n const response = await request(this.config, CommandsDomainNS.Delete, {\n sld,\n tld,\n nameserver\n });\n\n return response.commandResponse.domainNsDeleteResult;\n }\n\n async getInfo(sld: string, tld: string, nameserver: string): Promise<DomainNsInfoResult> {\n const response = await request(this.config, CommandsDomainNS.GetInfo, {\n sld,\n tld,\n nameserver\n });\n\n return response.commandResponse.domainNsInfoResult;\n }\n\n async update(sld: string, tld: string, nameserver: string, ip: string, oldIp: string): Promise<DomainNsUpdateResult> {\n const response = await request(this.config, CommandsDomainNS.Update, {\n sld,\n tld,\n nameserver,\n ip,\n oldIp\n });\n\n return response.commandResponse.domainNsUpdateResult;\n }\n}\n","import type {NamecheapProps} from \"@fwg/types/config.type\";\nimport {request} from \"@fwg/utils/service\";\nimport {CommandsDomainTransfer} from \"@fwg/utils/commands\";\nimport {\n CreateTransferParams,\n GetListTransferParams,\n ListType,\n SortBy\n} from \"@fwg/types/methods/params/domains-transfer-params.type\";\nimport {\n DomainTransferCreateResult,\n DomainTransferGetStatusResult, TransferGetResult\n} from \"@fwg/types/methods/response/domains-transfer.type\";\nimport {Paging} from \"@fwg/types/methods/base.type\";\n\nexport class DomainsTransfer {\n private readonly config: NamecheapProps;\n\n constructor(config: NamecheapProps) {\n this.config = config;\n }\n\n async create(domain: string, params: Omit<CreateTransferParams, \"domainName\">): Promise<DomainTransferCreateResult> {\n const response = await request(this.config, CommandsDomainTransfer.Create, {\n domainName: domain,\n ...params\n });\n return response.commandResponse.domainTransferCreateResult;\n }\n\n async getStatus(id: number): Promise<DomainTransferGetStatusResult> {\n const response = await request(this.config, CommandsDomainTransfer.GetStatus, {\n transferID: id\n });\n\n return response.commandResponse.domainTransferGetStatusResult;\n }\n\n async updateStatus(id: number, resubmit: boolean): Promise<number> {\n const response = await request(this.config, CommandsDomainTransfer.UpdateStatus, {\n transferID: id,\n resubmit\n });\n\n return response.commandResponse.domainTransferUpdateStatusResult;\n }\n\n async getList(params: GetListTransferParams = {\n listType: ListType.ALL,\n page: 1,\n pageSize: 10,\n sortBy: SortBy.DomainName\n }): Promise<{\n data: Array<TransferGetResult>,\n paging: Paging\n }> {\n const response = await request(this.config, CommandsDomainTransfer.GetList, params);\n\n return {\n data: response.commandResponse.transferGetListResult,\n paging: response.commandResponse.paging\n }\n }\n}\n","import {NamecheapProps} from \"@fwg/types/config.type\";\nimport {\n ActivateSSLParams,\n CreateSSLParams, EditDCVMethodParams,\n GetListSSLParams, ReissueSSLParams,\n RenewSSLParams,\n SSLType\n} from \"@fwg/types/methods/params/ssl-params.type\";\nimport {request, requestPost} from \"@fwg/utils/service\";\nimport {CommandsSSL} from \"@fwg/utils/commands\";\nimport {\n GetApproverEmailListResult, SSLActivateResult,\n SSLCreateResult, SSLEditDcvMethodResult, SSLGetInfoResult,\n SSLParseCsrResult, SSLPurchaseMoreSansResult, SSLRenewResult,\n SSLResult\n} from \"@fwg/types/methods/response/ssl.type\";\n\nexport class SSL {\n private readonly config: NamecheapProps;\n\n constructor(config: NamecheapProps) {\n this.config = config;\n }\n\n async create(params: CreateSSLParams): Promise<SSLCreateResult> {\n const response = await request(this.config, CommandsSSL.Create, params);\n return response.commandResponse.sslCreateResult;\n }\n\n async getList(params: GetListSSLParams): Promise<Array<SSLResult>> {\n const response = await request(this.config, CommandsSSL.GetList, params);\n return response.commandResponse.sslListResult;\n }\n\n async parseCSR(csr: string, certificateType?: SSLType): Promise<SSLParseCsrResult> {\n const response = await requestPost(this.config, CommandsSSL.ParseCRS, {\n csr,\n certificateType\n })\n\n return response.commandResponse.sslParseCsrResult;\n }\n\n async getApproverEmailList(domainName: string, certificateType?: SSLType): Promise<GetApproverEmailListResult> {\n const response = await request(this.config, CommandsSSL.GetApproverEmailList, {\n domainName,\n certificateType\n });\n return response.commandResponse.getApproverEmailListResult;\n }\n\n async activate(certificateId: number, params: Omit<ActivateSSLParams, \"certificateId\">): Promise<SSLActivateResult> {\n const response = await request(this.config, CommandsSSL.Activate, {\n certificateId,\n ...params\n })\n\n return response.commandResponse.sslActivateResult;\n }\n\n async resendApproverEmail(certificateId: number): Promise<number> {\n const response = await request(this.config, CommandsSSL.ResendApproverEmail, {\n certificateId\n })\n\n return response.commandResponse.sslResendApproverEmailResult;\n }\n\n async getInfo(certificateId: number): Promise<SSLGetInfoResult> {\n const response = await request(this.config, CommandsSSL.GetInfo, {\n certificateId\n })\n\n return response.commandResponse.sslGetInfoResult;\n }\n\n async renew(certificateId: number, params: Omit<RenewSSLParams, \"certificateId\">): Promise<SSLRenewResult> {\n const response = await request(this.config, CommandsSSL.Renew, {\n certificateId,\n ...params\n })\n\n return response.commandResponse.sslRenewResult;\n }\n\n async reissue(certificateId: number, params: Omit<ReissueSSLParams, \"certificateId\">): Promise<SSLActivateResult> {\n const response = await request(this.config, CommandsSSL.Reissue, {\n certificateId,\n ...params\n })\n\n return response.commandResponse.sslActivateResult;\n }\n\n async resendFulfillmentEmail(certificateId: number): Promise<number> {\n const response = await request(this.config, CommandsSSL.ResendFulfillmentEmail, {\n certificateId\n })\n\n return response.commandResponse.sslResendFulfillmentEmailResult;\n }\n\n async purchaseMoreSANS(certificateId: number, numberOfSANSToAdd: number): Promise<SSLPurchaseMoreSansResult> {\n const response = await request(this.config, CommandsSSL.PurchaseMoreSANS, {\n certificateId,\n numberOfSANSToAdd\n })\n\n return response.commandResponse.sslPurchaseMoreSansResult;\n }\n\n async revokeCertificate(certificateId: number, certificateType: SSLType): Promise<number> {\n const response = await request(this.config, CommandsSSL.RevokeCertificate, {\n certificateId,\n certificateType\n })\n\n return response.commandResponse.revokeCertificateResult;\n }\n\n async editDCVMethod(certificateId: number, params: Omit<EditDCVMethodParams, \"certificateId\">): Promise<SSLEditDcvMethodResult> {\n const response = await request(this.config, CommandsSSL.EditDCVMethod, {\n certificateId,\n ...params\n })\n\n return response.commandResponse.sslEditDcvMethodResult;\n }\n}","import {NamecheapProps} from \"@fwg/types/config.type\";\nimport {\n CreateAddFundsRequestParams, CreateUserParams,\n GetPricingUserParams, ResetPasswordParams,\n UpdateParams\n} from \"@fwg/types/methods/params/users-params.type\";\nimport {request} from \"@fwg/utils/service\";\nimport {CommandsUser} from \"@fwg/utils/commands\";\nimport {\n GetAddFundsStatusResult,\n UserCreateAddFundsRequest,\n UserGetBalancesResult,\n UserGetPricingResult\n} from \"@fwg/types/methods/response/users.type\";\n\nexport class Users {\n private readonly config: NamecheapProps;\n\n constructor(config: NamecheapProps) {\n this.config = config;\n }\n\n async getPricing(params: GetPricingUserParams): Promise<UserGetPricingResult> {\n const response = await request(this.config, CommandsUser.GetPricing, params);\n return response.commandResponse.userGetPricingResult\n }\n\n async getBalances(): Promise<UserGetBalancesResult> {\n const response = await request(this.config, CommandsUser.GetBalances);\n return response.commandResponse.userGetBalancesResult\n }\n\n async changePassword(oldPassword: string, newPassword: string): Promise<string> {\n const response = await request(this.config, CommandsUser.ChangePassword, {\n oldPassword,\n newPassword\n });\n return response.commandResponse.userChangePasswordResult\n }\n\n async update(params: UpdateParams): Promise<string> {\n const response = await request(this.config, CommandsUser.Update, params);\n return response.commandResponse.userUpdateResult\n }\n\n async createAddFundsRequest(username: string, params: Omit<CreateAddFundsRequestParams, \"username\">): Promise<UserCreateAddFundsRequest> {\n const response = await request(this.config, CommandsUser.CreateAddFundsRequest, {\n ...params,\n username,\n });\n\n return response.commandResponse.createaddfundsrequestresult\n }\n\n async getAddFundsStatus(tokenId: string): Promise<GetAddFundsStatusResult> {\n const response = await request(this.config, CommandsUser.GetAddFundsStatus, {\n tokenId\n });\n\n return response.commandResponse.getAddFundsStatusResult\n }\n\n async create(param: CreateUserParams): Promise<number> {\n const response = await request(this.config, CommandsUser.Create, param);\n\n return response.commandResponse.userCreateResult\n }\n\n async login(password: string): Promise<string> {\n const response = await request(this.config, CommandsUser.Login, {\n password\n });\n\n return response.commandResponse.userLoginResult\n }\n\n async resetPassword(params: ResetPasswordParams): Promise<string> {\n const response = await request(this.config, CommandsUser.ResetPassword, params);\n\n return response.commandResponse.userResetPasswordResult\n }\n}","import {NamecheapProps} from \"@fwg/types/config.type\";\nimport {request} from \"@fwg/utils/service\";\nimport {CommandsUserAddress} from \"@fwg/utils/commands\";\nimport {\n AddressCreateResult,\n AddressDeleteResult, AddressGetListResult, AddressUpdateResult,\n GetAddressInfoResult\n} from \"@fwg/types/methods/response/users-address.type\";\nimport {CreateUserAddressParams, UpdateUserAddressParams} from \"@fwg/types/methods/params/users-address-params.type\";\n\nexport class UsersAddress {\n private readonly config: NamecheapProps;\n\n constructor(config: NamecheapProps) {\n this.config = config;\n }\n\n async create(param: CreateUserAddressParams): Promise<AddressCreateResult> {\n const response = await request(this.config, CommandsUserAddress.Create, param);\n return response.commandResponse.addressCreateResult\n }\n\n async delete(addressId: number): Promise<AddressDeleteResult> {\n const response = await request(this.config, CommandsUserAddress.Delete, {\n addressId\n });\n\n return response.commandResponse.addressDeleteResult\n }\n\n async getInfo(addressId: number): Promise<GetAddressInfoResult> {\n const response = await request(this.config, CommandsUserAddress.GetInfo, {\n addressId\n });\n\n return response.commandResponse.getAddressInfoResult\n }\n\n async getList(): Promise<AddressGetListResult> {\n const response = await request(this.config, CommandsUserAddress.GetList);\n\n return response.commandResponse.addressGetListResult\n }\n\n async setDefault(addressId: number): Promise<number> {\n const response = await request(this.config, CommandsUserAddress.SetDefault, {\n addressId\n });\n\n return response.commandResponse.addressSetDefaultResult\n }\n\n async update(addressId: number, params: Omit<UpdateUserAddressParams, \"addressId\">): Promise<AddressUpdateResult> {\n const response = await request(this.config, CommandsUserAddress.Update, {\n ...params,\n addressId\n });\n\n return response.commandResponse.addressUpdateResult\n }\n}","import {NamecheapProps} from \"@fwg/types/config.type\";\nimport {request} from \"@fwg/utils/service\";\nimport {CommandsWhoIsGuard} from \"@fwg/utils/commands\";\nimport {\n WhoIsGuardChangeEmailAddressResult,\n WhoIsGuardGetListResult, WhoIsGuardRenewResult\n} from \"@fwg/types/methods/response/whois-guard.type\";\nimport {GetListParams} from \"@fwg/types/methods/params/whois-guard-params.type\";\nimport {Paging} from \"@fwg/types/methods/base.type\";\n\nexport class WhoIsGuard {\n private readonly config: NamecheapProps;\n\n constructor(config: NamecheapProps) {\n this.config = config;\n }\n\n async changeEmailAddress(whoIsGuardId: number): Promise<WhoIsGuardChangeEmailAddressResult> {\n const response = await request(this.config, CommandsWhoIsGuard.ChangeEmailAddress, {\n whoIsGuardId\n });\n\n return response.commandResponse.whoisguardChangeEmailAddressResult;\n }\n\n\n async enable(whoIsGuardId: number, forwardedToEmail: string): Promise<string> {\n const response = await request(this.config, CommandsWhoIsGuard.Enable, {\n whoIsGuardId,\n forwardedToEmail\n });\n\n return response.commandResponse.whoisguardEnableResult;\n }\n\n async disable(whoIsGuardId: number): Promise<string> {\n const response = await request(this.config, CommandsWhoIsGuard.Disable, {\n whoIsGuardId,\n });\n\n return response.commandResponse.whoisguardDisableResult;\n }\n\n async getList(param: GetListParams): Promise<{\n data: Array<WhoIsGuardGetListResult>,\n paging: Paging\n }> {\n const response = await request(this.config, CommandsWhoIsGuard.GetList, param);\n\n return {\n data: response.commandResponse.whoisguardGetListResult,\n paging: response.commandResponse.paging\n }\n }\n\n async renew(whoIsGuardId: string, year: number, promotionCode?: number): Promise<WhoIsGuardRenewResult> {\n const response = await request(this.config, CommandsWhoIsGuard.Renew, {\n whoIsGuardId,\n year,\n prom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AAU,IAAIE,EAAQ,KAAK,UAAU,CAAC,EAC3C,KAAK,WAAa,IAAIC,EAAW,KAAK,UAAU,CAAC,EACjD,KAAK,UAAY,IAAIC,EAAU,KAAK,UAAU,CAAC,EAC/C,KAAK,gBAAkB,IAAIC,EAAgB,KAAK,UAAU,CAAC,EAC3D,KAAK,IAAM,IAAIC,EAAI,KAAK,UAAU,CAAC,EACnC,KAAK,MAAQ,IAAIC,EAAM,KAAK,UAAU,CAAC,EACvC,KAAK,aAAe,IAAIC,EAAa,KAAK,UAAU,CAAC,EACrD,KAAK,WAAa,IAAIC,EAAW,KAAK,UAAU,CAAC,CACrD,CAEQ,WAA4B,CAChC,MAAO,CACH,QAAS,KAAK,QACd,OAAQ,KAAK,OACb,SAAU,KAAK,SACf,SAAU,KAAK,SACf,OAAQ,KAAK,MACjB,CACJ,CACJ","names":["index_exports","__export","Namecheap","__toCommonJS","import_fast_xml_parser","import_change_case_all","simplifyObject","obj","item","keys","key","keyWithValue","acc","newKey","simplifiedValue","getNamecheapHost","isSandbox","checkRequestError","response","flattenObjectToArray","input","prefix","arrayFormat","result","key","value","capitalizedKey","item","index","tagNamesArray","parser","_tagName","jPath","tagName","attributeName","request","namecheapProps","command","params","apiUser","apiKey","apiUrl","username","clientIp","url","xmlData","parsedValue","json","simplifyObject","error","requestPost","rootParams","requestValues","body","Domains","config","params","response","request","domainName","domain","domains","DomainsDNS","config","sld","tld","request","nameservers","domain","params","hosts","paramsFormatted","acc","host","i","key","value","response","requestPost","DomainsNS","config","sld","tld","nameserver","ip","request","oldIp","DomainsTransfer","config","domain","params","request","id","resubmit","response","SSL","config","params","request","csr","certificateType","requestPost","domainName","certificateId","numberOfSANSToAdd","Users","config","params","request","oldPassword","newPassword","username","tokenId","param","password","UsersAddress","config","param","request","addressId","params","WhoIsGuard","config","whoIsGuardId","request","forwardedToEmail","param","response","year","promotionCode","Namecheap","config","apiUser","apiKey","username","clientIp","sandbox","getNamecheapHost","Domains","DomainsDNS","DomainsNS","DomainsTransfer","SSL","Users","UsersAddress","WhoIsGuard"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/utils/service.ts","../src/utils/xml.ts","../src/types/enum.ts","../src/methods/domains/index.ts","../src/methods/domains/dns.ts","../src/methods/domains/ns.ts","../src/methods/domains/transfer.ts","../src/methods/ssl/index.ts","../src/methods/users/index.ts","../src/methods/users/address.ts","../src/methods/whois-guard/index.ts"],"sourcesContent":["import { ConfigType, type NamecheapProps } from \"./types/config.type\";\nimport { getNamecheapHost } from \"./utils/service\";\nimport { Domains } from \"./methods/domains\";\nimport { DomainsDNS } from \"@fwg/methods/domains/dns\";\nimport { DomainsNS } from \"@fwg/methods/domains/ns\";\nimport { DomainsTransfer } from \"@fwg/methods/domains/transfer\";\nimport { SSL } from \"@fwg/methods/ssl\";\nimport { Users } from \"@fwg/methods/users\";\nimport { UsersAddress } from \"@fwg/methods/users/address\";\nimport { WhoIsGuard } from \"src/methods/whois-guard\";\n\nexport default class Namecheap {\n private readonly apiUrl: string;\n private readonly apiUser: string;\n private readonly apiKey: string;\n private readonly username: string;\n private readonly clientIp: string;\n\n public readonly domains: Domains;\n public readonly domainsDns: DomainsDNS;\n public readonly domainsNs: DomainsNS;\n public readonly domainsTransfer: DomainsTransfer;\n\n public readonly ssl: SSL;\n\n public readonly users: Users;\n public readonly usersAddress: UsersAddress;\n public readonly whoIsGuard: WhoIsGuard;\n\n public get domainPrivacy(): WhoIsGuard {\n return this.whoIsGuard;\n }\n\n constructor(config: ConfigType) {\n const { apiUser, apiKey, username, clientIp, sandbox } = config;\n\n this.apiUser = apiUser;\n this.apiKey = apiKey;\n this.username = username || apiUser;\n this.clientIp = clientIp;\n this.apiUrl = getNamecheapHost(sandbox);\n\n this.domains = new Domains(this.getConfig());\n this.domainsDns = new DomainsDNS(this.getConfig());\n this.domainsNs = new DomainsNS(this.getConfig());\n this.domainsTransfer = new DomainsTransfer(this.getConfig());\n this.ssl = new SSL(this.getConfig());\n this.users = new Users(this.getConfig());\n this.usersAddress = new UsersAddress(this.getConfig());\n this.whoIsGuard = new WhoIsGuard(this.getConfig());\n }\n\n private getConfig(): NamecheapProps {\n return {\n apiUser: this.apiUser,\n apiKey: this.apiKey,\n username: this.username,\n clientIp: this.clientIp,\n apiUrl: this.apiUrl,\n };\n }\n}\n\nexport * from \"./types/enum\";\n","import { XMLParser } from \"fast-xml-parser\";\nimport { camelCase, pascalCase } from \"change-case-all\";\nimport { simplifyObject } from \"./xml\";\nimport type { NamecheapProps } from \"../types/config.type\";\nimport {\n NamecheapXMLParsedBase,\n NamecheapXMLParsedFail,\n NamecheapXMLParsedSuccess,\n RequestValues,\n} from \"../types/methods/base.type\";\nimport {\n MappedResponseSuccess,\n NamecheapParamsMap,\n NamecheapPostParamsMap,\n NamecheapRootParamsMap,\n} from \"../types/methods/mapped.type\";\n\nexport const getNamecheapHost = (isSandbox: boolean): string => {\n const host = !isSandbox ? \"api.namecheap.com\" : \"api.sandbox.namecheap.com\";\n return `https://${host}/xml.response`;\n};\n\nconst checkRequestError = (response: NamecheapXMLParsedBase | NamecheapXMLParsedFail): boolean =>\n response.status === \"ERROR\" || Object.hasOwnProperty.call(response, \"errors\");\n\n/* eslint-disable */\nconst flattenObjectToArray = (\n input: Record<string, any>,\n prefix: string = \"\",\n arrayFormat = true,\n): Array<[string, string]> => {\n const result: Array<[string, string]> = [];\n\n Object.entries(input).forEach(([key, value]) => {\n const capitalizedKey = pascalCase(`${prefix} ${key}`);\n\n if (typeof value === \"object\" && value !== null && !Array.isArray(value)) {\n result.push(...flattenObjectToArray(value, capitalizedKey));\n } else if (typeof value === \"object\" && value !== null && Array.isArray(value)) {\n value.forEach((item, index) => {\n if (arrayFormat) {\n result.push([`${capitalizedKey}[${index + 1}]`, String(item)]);\n } else {\n result.push([`${capitalizedKey}${index + 1}`, String(item)]);\n }\n });\n } else if (value !== undefined && value !== null) {\n result.push([capitalizedKey, String(value)]);\n }\n });\n\n return result;\n};\n\nconst tagNamesArray = [\n \"apiResponse.commandResponse.tlds.tld\",\n \"apiResponse.commandResponse.tlds.tld.categories\",\n \"apiResponse.commandResponse.domainGetListResult.domain\",\n \"apiResponse.commandResponse.domainCheckResult\",\n \"apiResponse.commandResponse.userGetPricingResult.productType.productCategory\",\n \"apiResponse.commandResponse.userGetPricingResult.productType.productCategory.product\",\n \"apiResponse.commandResponse.userGetPricingResult.productType.productCategory.product.price\",\n \"apiResponse.commandResponse.whoisguardGetListResult.whoisguardGetListResult.whoisguard\",\n \"apiResponse.commandResponse.domainDnsGetEmailForwardingResult.forward\",\n \"apiResponse.commandResponse.domainDnsSetHostsResult\",\n];\n\nconst parser = new XMLParser({\n allowBooleanAttributes: true,\n attributeNamePrefix: \"\",\n ignoreAttributes: false,\n processEntities: true,\n parseTagValue: true,\n parseAttributeValue: true,\n trimValues: true,\n isArray: (_tagName, jPath) => {\n return tagNamesArray.includes(jPath);\n },\n transformTagName: (tagName) => camelCase(tagName),\n transformAttributeName: (attributeName) => camelCase(attributeName),\n});\n\nexport async function request<T extends keyof MappedResponseSuccess>(\n namecheapProps: NamecheapProps,\n command: T,\n params: NamecheapParamsMap[T] = {} as NamecheapParamsMap[T],\n): Promise<NamecheapXMLParsedSuccess<MappedResponseSuccess[T]>> {\n const { apiUser, apiKey, apiUrl, username, clientIp } = namecheapProps;\n\n let url = new URL(apiUrl);\n url.searchParams.append(\"ApiUser\", apiUser);\n url.searchParams.append(\"ApiKey\", apiKey);\n url.searchParams.append(\"UserName\", username);\n url.searchParams.append(\"ClientIp\", clientIp);\n url.searchParams.append(\"Command\", command);\n\n flattenObjectToArray(params).forEach(([key, value]) => {\n url.searchParams.append(key, value);\n });\n\n const response = await fetch(url.toString());\n\n if (!response.ok) {\n throw new Error(`Error in API Namecheap: ${response.statusText}`);\n }\n\n const xmlData = await response.text();\n\n // await response.text();\n const parsedValue: { apiResponse: MappedResponseSuccess[T] } = parser.parse(xmlData);\n const json: NamecheapXMLParsedBase = simplifyObject(parsedValue.apiResponse);\n\n if (checkRequestError(json)) {\n const error = (json as NamecheapXMLParsedFail).errors;\n throw {\n code: error.number || -1,\n message: error.value || \"Unknown Error\",\n };\n }\n\n return json as NamecheapXMLParsedSuccess<MappedResponseSuccess[T]>;\n}\n\nexport async function requestPost<T extends keyof MappedResponseSuccess>(\n namecheapProps: NamecheapProps,\n command: T,\n rootParams: NamecheapRootParamsMap[T] = {} as NamecheapRootParamsMap[T],\n params: NamecheapPostParamsMap[T] = {} as NamecheapPostParamsMap[T],\n): Promise<NamecheapXMLParsedSuccess<MappedResponseSuccess[T]>> {\n const { apiUser, apiKey, apiUrl, username, clientIp } = namecheapProps;\n\n let url = new URL(apiUrl);\n url.searchParams.append(\"ApiUser\", apiUser);\n url.searchParams.append(\"ApiKey\", apiKey);\n url.searchParams.append(\"UserName\", username);\n url.searchParams.append(\"ClientIp\", clientIp);\n url.searchParams.append(\"Command\", command);\n\n const requestValues: Array<RequestValues> = [];\n\n flattenObjectToArray(rootParams).forEach(([key, value]) => {\n url.searchParams.append(key, value);\n });\n\n flattenObjectToArray(params, \"\", false).forEach(([key, value]) => {\n requestValues.push({\n Key: key,\n Value: value,\n });\n });\n\n const body = {\n request: {\n RequestValues: requestValues,\n },\n };\n\n const response = await fetch(url.toString(), {\n method: \"POST\",\n body: JSON.stringify(body),\n });\n\n if (!response.ok) {\n throw new Error(`Error in API Namecheap: ${response.statusText}`);\n }\n\n const xmlData = await response.text();\n const parsedValue: { apiResponse: MappedResponseSuccess[T] } = parser.parse(xmlData);\n const json: NamecheapXMLParsedBase = simplifyObject(parsedValue.apiResponse);\n\n if (checkRequestError(json)) {\n const error = (json as NamecheapXMLParsedFail).errors;\n throw {\n code: error.number,\n message: error.value,\n };\n }\n\n return json as NamecheapXMLParsedSuccess<MappedResponseSuccess[T]>;\n}\n","// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const simplifyObject = (obj: any): any => {\n if (Array.isArray(obj)) {\n return obj\n .map(simplifyObject)\n .filter((item) => item !== null && item !== undefined && item !== \"\");\n } else if (typeof obj === \"object\" && obj !== null) {\n const keys = Object.keys(obj);\n\n if (\n keys.length === 2 &&\n keys.includes(\"#text\") &&\n keys.some((key) => key !== \"#text\" && obj[key] === true)\n ) {\n return obj[\"#text\"];\n }\n\n if (keys.length === 2 && keys.some((key) => obj[key] === true)) {\n const keyWithValue = keys.find((key) => obj[key] !== true);\n return simplifyObject(obj[keyWithValue!]);\n }\n\n return Object.keys(obj).reduce(\n (acc, key) => {\n const newKey = key === \"#text\" ? \"value\" : key;\n const simplifiedValue = simplifyObject(obj[key]);\n\n if (simplifiedValue !== null && simplifiedValue !== undefined && simplifiedValue !== \"\") {\n acc[newKey] = simplifiedValue;\n }\n\n return acc;\n },\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n {} as Record<string, any>,\n );\n }\n\n return obj;\n};\n","export const RecordType = {\n A: \"A\",\n AAAA: \"AAAA\",\n ALIAS: \"ALIAS\",\n CAA: \"CAA\",\n CNAME: \"CNAME\",\n MX: \"MX\",\n MXE: \"MXE\",\n NS: \"NS\",\n TXT: \"TXT\",\n URL: \"URL\",\n URL301: \"URL301\",\n FRAME: \"FRAME\",\n} as const;\nexport type RecordType = (typeof RecordType)[keyof typeof RecordType];\n\nexport const EmailType = {\n MXE: \"MXE\",\n MX: \"MX\",\n FWD: \"FWD\",\n OX: \"OX\",\n} as const;\nexport type EmailType = (typeof EmailType)[keyof typeof EmailType];\n\nexport const LockAction = {\n Lock: \"LOCK\",\n Unlock: \"UNLOCK\",\n} as const;\nexport type LockAction = (typeof LockAction)[keyof typeof LockAction];\n\nexport const DomainListType = {\n All: \"ALL\",\n Expiring: \"EXPIRING\",\n Expired: \"EXPIRED\",\n} as const;\nexport type DomainListType = (typeof DomainListType)[keyof typeof DomainListType];\n\nexport const DomainListSortBy = {\n NameAsc: \"NAME\",\n NameDesc: \"NAME_DESC\",\n ExpireDateAsc: \"EXPIREDATE\",\n ExpireDateDesc: \"EXPIREDATE_DESC\",\n CreateDateAsc: \"CREATEDATE\",\n CreateDateDesc: \"CREATEDATE_DESC\",\n} as const;\nexport type DomainListSortBy = (typeof DomainListSortBy)[keyof typeof DomainListSortBy];\n\nexport const IdnCode = {\n AFR: \"afr\",\n ALB: \"alb\",\n ARA: \"ara\",\n ARG: \"arg\",\n ARM: \"arm\",\n ASM: \"asm\",\n AST: \"ast\",\n AVE: \"ave\",\n AWA: \"awa\",\n AZE: \"aze\",\n BAK: \"bak\",\n BAL: \"bal\",\n BAN: \"ban\",\n BAQ: \"baq\",\n BAS: \"bas\",\n BEL: \"bel\",\n BEN: \"ben\",\n BHO: \"bho\",\n BOS: \"bos\",\n BUL: \"bul\",\n BUR: \"bur\",\n CAR: \"car\",\n CAT: \"cat\",\n CHE: \"che\",\n CHI: \"chi\",\n CHV: \"chv\",\n COP: \"cop\",\n COS: \"cos\",\n CZE: \"cze\",\n DAN: \"dan\",\n DIV: \"div\",\n DOI: \"doi\",\n DUT: \"dut\",\n ENG: \"eng\",\n EST: \"est\",\n FAO: \"fao\",\n FIJ: \"fij\",\n FIN: \"fin\",\n FRE: \"fre\",\n FRY: \"fry\",\n GEO: \"geo\",\n GER: \"ger\",\n GLA: \"gla\",\n GLE: \"gle\",\n GON: \"gon\",\n GRE: \"gre\",\n GUJ: \"guj\",\n HEB: \"heb\",\n HIN: \"hin\",\n HUN: \"hun\",\n INC: \"inc\",\n IND: \"ind\",\n INH: \"inh\",\n ISL: \"isl\",\n ITA: \"ita\",\n JAV: \"jav\",\n JPN: \"jpn\",\n KAS: \"kas\",\n KAZ: \"kaz\",\n KHM: \"khm\",\n KIR: \"kir\",\n KOR: \"kor\",\n KUR: \"kur\",\n LAO: \"lao\",\n LAV: \"lav\",\n LIT: \"lit\",\n LTZ: \"ltz\",\n MAL: \"mal\",\n MKD: \"mkd\",\n MLT: \"mlt\",\n MOL: \"mol\",\n MON: \"mon\",\n MRI: \"mri\",\n MSA: \"msa\",\n NEP: \"nep\",\n NOR: \"nor\",\n ORI: \"ori\",\n OSS: \"oss\",\n PAN: \"pan\",\n PER: \"per\",\n POL: \"pol\",\n POR: \"por\",\n PUS: \"pus\",\n RAJ: \"raj\",\n RUM: \"rum\",\n RUS: \"rus\",\n SAN: \"san\",\n SCR: \"scr\",\n SIN: \"sin\",\n SLO: \"slo\",\n SLV: \"slv\",\n SMO: \"smo\",\n SND: \"snd\",\n SOM: \"som\",\n SPA: \"spa\",\n SRD: \"srd\",\n SRP: \"srp\",\n SWA: \"swa\",\n SWE: \"swe\",\n SYR: \"syr\",\n TAM: \"tam\",\n TEL: \"tel\",\n TGK: \"tgk\",\n THA: \"tha\",\n TIB: \"tib\",\n TUR: \"tur\",\n UKR: \"ukr\",\n URD: \"urd\",\n UZB: \"uzb\",\n VIE: \"vie\",\n WEL: \"wel\",\n YID: \"yid\",\n} as const;\nexport type IdnCode = (typeof IdnCode)[keyof typeof IdnCode];\n\nexport const DomainTransferListType = {\n All: \"ALL\",\n InProgress: \"INPROGRESS\",\n Cancelled: \"CANCELLED\",\n Completed: \"COMPLETED\",\n} as const;\nexport type DomainTransferListType =\n (typeof DomainTransferListType)[keyof typeof DomainTransferListType];\n\nexport const DomainTransferSortBy = {\n DomainName: \"DOMAINNAME\",\n DomainNameDesc: \"DOMAINNAME_DESC\",\n TransferDate: \"TRANSFERDATE\",\n TransferDateDesc: \"TRANSFERDATE_DESC\",\n StatusDate: \"STATUSDATE\",\n StatusDateDesc: \"STATUSDATE_DESC\",\n} as const;\nexport type DomainTransferSortBy = (typeof DomainTransferSortBy)[keyof typeof DomainTransferSortBy];\n\nexport const SSLType = {\n PositiveSSL: \"PositiveSSL\",\n EssentialSSL: \"EssentialSSL\",\n InstantSSL: \"InstantSSL\",\n InstantSSLPro: \"InstantSSL Pro\",\n PremiumSSL: \"PremiumSSL\",\n EVSSL: \"EV SSL\",\n PositiveSSLWildcard: \"PositiveSSL Wildcard\",\n EssentialSSLWildcard: \"EssentialSSL Wildcard\",\n PremiumSSLWildcard: \"PremiumSSL Wildcard\",\n PositiveSSLMultiDomain: \"PositiveSSL Multi Domain\",\n MultiDomainSSL: \"Multi Domain SSL\",\n UnifiedCommunications: \"Unified Communications\",\n EVMultiDomainSSL: \"EV Multi Domain SSL\",\n} as const;\nexport type SSLType = (typeof SSLType)[keyof typeof SSLType];\n\nexport const SSLListType = {\n ALL: \"ALL\",\n Processing: \"Processing\",\n EmailSent: \"EmailSent\",\n TechnicalProblem: \"TechnicalProblem\",\n InProgress: \"InProgress\",\n Completed: \"Completed\",\n Deactivated: \"Deactivated\",\n Active: \"Active\",\n Cancelled: \"Cancelled\",\n NewPurchase: \"NewPurchase\",\n NewRenewal: \"NewRenewal\",\n} as const;\nexport type SSLListType = (typeof SSLListType)[keyof typeof SSLListType];\n\nexport const SSLListSortBy = {\n PurchaseDate: \"PURCHASEDATE\",\n PurchaseDateDesc: \"PURCHASEDATE_DESC\",\n SSLType: \"SSLTYPE\",\n SSLTypeDesc: \"SSLTYPE_DESC\",\n ExpireDateTime: \"EXPIREDATETIME\",\n ExpireDateTimeDesc: \"EXPIREDATETIME_DESC\",\n Hostname: \"Host_Name\",\n HostnameDesc: \"Host_Name_DESC\",\n} as const;\nexport type SSLListSortBy = (typeof SSLListSortBy)[keyof typeof SSLListSortBy];\n\nexport const UserProductType = {\n Domain: \"DOMAIN\",\n SslCertificate: \"SSLCERTIFICATE\",\n} as const;\nexport type UserProductType = (typeof UserProductType)[keyof typeof UserProductType];\n\nexport const UserProductCategory = {\n Domains: \"DOMAINS\",\n Comodo: \"COMODO\",\n} as const;\nexport type UserProductCategory = (typeof UserProductCategory)[keyof typeof UserProductCategory];\n\nexport const UserActionName = {\n Register: \"REGISTER\",\n Renew: \"RENEW\",\n Reactivate: \"REACTIVATE\",\n Transfer: \"TRANSFER\",\n Purchase: \"PURCHASE\",\n} as const;\nexport type UserActionName = (typeof UserActionName)[keyof typeof UserActionName];\n\nexport const UserProductName = {\n COM: \"COM\",\n InstantSsl: \"INSTANTSSL\",\n} as const;\nexport type UserProductName = (typeof UserProductName)[keyof typeof UserProductName];\n\nexport const UserPaymentType = {\n CreditCard: \"Creditcard\",\n} as const;\nexport type UserPaymentType = (typeof UserPaymentType)[keyof typeof UserPaymentType];\n\nexport const UserListFindBy = {\n EmailAddress: \"EMAILADDRESS\",\n DomainName: \"DOMAINNAME\",\n Username: \"USERNAME\",\n} as const;\nexport type UserListFindBy = (typeof UserListFindBy)[keyof typeof UserListFindBy];\n\nexport const WhoIsListType = {\n All: \"ALL\",\n Alloted: \"ALLOTED\",\n Free: \"FREE\",\n Discard: \"DISCARD\",\n} as const;\nexport type WhoIsListType = (typeof WhoIsListType)[keyof typeof WhoIsListType];\n\nexport const GetAddFundsStatus = {\n Created: \"CREATED\",\n Submitted: \"SUBMITTED\",\n Completed: \"COMPLETED\",\n Failed: \"FAILED\",\n Expired: \"EXPIRED\",\n} as const;\nexport type GetAddFundsStatus = (typeof GetAddFundsStatus)[keyof typeof GetAddFundsStatus];\n","import { NamecheapProps } from \"@fwg/types/config.type\";\nimport { request } from \"@fwg/utils/service\";\nimport { CommandsDomain } from \"@fwg/utils/commands\";\nimport {\n DomainCheckResult,\n DomainContactsResult,\n DomainCreateResult,\n DomainGetInfoResult,\n DomainGetListResult,\n DomainGetRegistrarLockResult,\n DomainReactivateResult,\n DomainRenewResult,\n DomainSetRegistrarLockResult,\n TLD,\n} from \"@fwg/types/methods/response/domains.type\";\nimport type {\n ContactDomainParams,\n CreateDomainParams,\n GetListParams,\n ReactivateDomainParams,\n RenewDomainParams,\n SetRegistrarLockParams,\n} from \"@fwg/types/methods/params/domains-params.type\";\nimport { Paging } from \"@fwg/types/methods/base.type\";\nimport { DomainListType, LockAction } from \"@fwg/types/enum\";\n\nexport class Domains {\n private readonly config: NamecheapProps;\n\n constructor(config: NamecheapProps) {\n this.config = config;\n }\n\n async getList(\n params: GetListParams = {\n listType: DomainListType.All,\n page: 1,\n pageSize: 20,\n },\n ): Promise<{\n data: Array<DomainGetListResult>;\n paging: Paging;\n }> {\n const response = await request(this.config, CommandsDomain.GetList, params);\n return {\n data: response.commandResponse.domainGetListResult,\n paging: response.commandResponse.paging,\n };\n }\n\n async getContacts(domainName: string): Promise<DomainContactsResult> {\n const response = await request(this.config, CommandsDomain.GetContact, {\n domainName,\n });\n return response.commandResponse.domainContactsResult;\n }\n\n async create(\n domain: string,\n params: Omit<CreateDomainParams, \"domainName\">,\n ): Promise<DomainCreateResult> {\n const response = await request(this.config, CommandsDomain.Create, {\n ...params,\n domainName: domain,\n });\n\n return response.commandResponse.domainCreateResult;\n }\n\n async getTldList(): Promise<Array<TLD>> {\n const response = await request(this.config, CommandsDomain.GetTldList);\n return response.commandResponse.tlds;\n }\n\n async setContacts(\n domain: string,\n params: Omit<ContactDomainParams, \"domainName\">,\n ): Promise<string> {\n const response = await request(this.config, CommandsDomain.SetContact, {\n ...params,\n domainName: domain,\n });\n\n return response.commandResponse.domainSetContactResult;\n }\n\n async check(domains: Array<string>): Promise<DomainCheckResult> {\n const response = await request(this.config, CommandsDomain.Check, {\n domainList: domains.join(),\n });\n\n return response.commandResponse.domainCheckResult;\n }\n\n async reactivate(\n domain: string,\n params: Omit<ReactivateDomainParams, \"domainName\"> = {},\n ): Promise<DomainReactivateResult> {\n const response = await request(this.config, CommandsDomain.Reactivate, {\n ...params,\n domainName: domain,\n });\n\n return response.commandResponse.domainReactivateResult;\n }\n\n async renew(\n domain: string,\n params: Omit<RenewDomainParams, \"domainName\">,\n ): Promise<DomainRenewResult> {\n const response = await request(this.config, CommandsDomain.Renew, {\n ...params,\n domainName: domain,\n });\n\n return response.commandResponse.domainRenewResult;\n }\n\n async getRegistrarLock(domain: string): Promise<DomainGetRegistrarLockResult> {\n const response = await request(this.config, CommandsDomain.GetRegistrarLock, {\n domainName: domain,\n });\n\n return response.commandResponse.domainGetRegistrarLockResult;\n }\n\n async setRegistrarLock(\n domain: string,\n params: Omit<SetRegistrarLockParams, \"domainName\"> = {\n lockAction: LockAction.Lock,\n },\n ): Promise<DomainSetRegistrarLockResult> {\n const response = await request(this.config, CommandsDomain.SetRegistrarLock, {\n ...params,\n domainName: domain,\n });\n\n return response.commandResponse.domainSetRegistrarLockResult;\n }\n\n async getInfo(domain: string, hostName?: string): Promise<DomainGetInfoResult> {\n const response = await request(this.config, CommandsDomain.GetInfo, {\n domainName: domain,\n hostName,\n });\n\n return response.commandResponse.domainGetInfoResult;\n }\n}\n","import type { NamecheapProps } from \"@fwg/types/config.type\";\nimport {\n DomainDnsGetEmailForwardingResult,\n DomainDnsGetHostsResult,\n DomainDnsGetListResult,\n} from \"@fwg/types/methods/response/domains-dns.type\";\nimport { request, requestPost } from \"@fwg/utils/service\";\nimport { CommandsDomainDNS } from \"@fwg/utils/commands\";\nimport {\n Host,\n SetDNSEmailForwardingParams,\n SetDNSHostsParams,\n} from \"@fwg/types/methods/params/domains-dns-params.type\";\nimport { RecordType } from \"@fwg/types/enum\";\n\nexport class DomainsDNS {\n private readonly config: NamecheapProps;\n\n constructor(config: NamecheapProps) {\n this.config = config;\n }\n\n async setDefault(sld: string, tld: string): Promise<string> {\n const response = await request(this.config, CommandsDomainDNS.SetDefault, {\n sld,\n tld,\n });\n\n return response.commandResponse.domainDnsSetDefaultResult;\n }\n\n async setCustom(sld: string, tld: string, nameservers: Array<string>): Promise<string> {\n const response = await request(this.config, CommandsDomainDNS.SetCustom, {\n sld,\n tld,\n nameservers,\n });\n\n return response.commandResponse.domainDNSSetCustomResult;\n }\n\n async getList(sld: string, tld: string): Promise<DomainDnsGetListResult> {\n const response = await request(this.config, CommandsDomainDNS.GetList, {\n sld,\n tld,\n });\n\n return response.commandResponse.domainDnsGetListResult;\n }\n\n async getHosts(sld: string, tld: string): Promise<DomainDnsGetHostsResult> {\n const response = await request(this.config, CommandsDomainDNS.GetHosts, {\n sld,\n tld,\n });\n\n return response.commandResponse.domainDnsGetHostsResult;\n }\n\n async getEmailForwarding(domain: string): Promise<DomainDnsGetEmailForwardingResult> {\n const response = await request(this.config, CommandsDomainDNS.GetEmailForwarding, {\n domainName: domain,\n });\n\n return response.commandResponse.domainDnsGetEmailForwardingResult;\n }\n\n async setEmailForwarding(\n domain: string,\n params: Omit<SetDNSEmailForwardingParams, \"domainName\">,\n ): Promise<string> {\n const response = await request(this.config, CommandsDomainDNS.SetEmailForwarding, {\n ...params,\n domainName: domain,\n });\n\n return response.commandResponse.domainDnsSetEmailForwardingResult;\n }\n\n async setHosts(\n sld: string,\n tld: string,\n params: Omit<\n SetDNSHostsParams,\n \"sld\" | \"tld\" | \"address\" | \"hostname\" | \"mxpref\" | \"recordType\" | \"ttl\"\n > & { hosts: Array<Host> },\n ): Promise<Array<string>> {\n const { hosts } = params;\n const paramsFormatted = hosts.reduce(\n (acc, host, i) => {\n Object.entries(host).forEach(([key, value]) => {\n // @ts-expect-error is a safe setter\n acc[key][i] = value;\n });\n\n return acc;\n },\n {\n hostname: [] as Array<string>,\n ttl: [] as Array<number>,\n address: [] as Array<string>,\n mxpref: [] as Array<string>,\n recordType: [] as Array<RecordType>,\n },\n );\n let response;\n\n if (hosts.length > 10) {\n response = await requestPost(\n this.config,\n CommandsDomainDNS.SetHosts,\n {\n SLD: sld,\n TLD: tld,\n },\n {\n ...paramsFormatted,\n tag: params.tag,\n flag: params.flag,\n emailType: params.emailType,\n },\n );\n } else {\n response = await request(this.config, CommandsDomainDNS.SetHosts, {\n ...paramsFormatted,\n sld,\n tld,\n tag: params.tag,\n flag: params.flag,\n emailType: params.emailType,\n });\n }\n\n return response.commandResponse.domainDnsSetHostsResult;\n }\n}\n","import type { NamecheapProps } from \"@fwg/types/config.type\";\nimport { request } from \"@fwg/utils/service\";\nimport { CommandsDomainNS } from \"@fwg/utils/commands\";\nimport {\n DomainNsCreateResult,\n DomainNsDeleteResult,\n DomainNsInfoResult,\n DomainNsUpdateResult,\n} from \"@fwg/types/methods/response/domains-ns.type\";\n\nexport class DomainsNS {\n private readonly config: NamecheapProps;\n\n constructor(config: NamecheapProps) {\n this.config = config;\n }\n\n async create(\n sld: string,\n tld: string,\n nameserver: string,\n ip: string,\n ): Promise<DomainNsCreateResult> {\n const response = await request(this.config, CommandsDomainNS.Create, {\n sld,\n tld,\n nameserver,\n ip,\n });\n\n return response.commandResponse.domainNsCreateResult;\n }\n\n async delete(sld: string, tld: string, nameserver: string): Promise<DomainNsDeleteResult> {\n const response = await request(this.config, CommandsDomainNS.Delete, {\n sld,\n tld,\n nameserver,\n });\n\n return response.commandResponse.domainNsDeleteResult;\n }\n\n async getInfo(sld: string, tld: string, nameserver: string): Promise<DomainNsInfoResult> {\n const response = await request(this.config, CommandsDomainNS.GetInfo, {\n sld,\n tld,\n nameserver,\n });\n\n return response.commandResponse.domainNsInfoResult;\n }\n\n async update(\n sld: string,\n tld: string,\n nameserver: string,\n ip: string,\n oldIp: string,\n ): Promise<DomainNsUpdateResult> {\n const response = await request(this.config, CommandsDomainNS.Update, {\n sld,\n tld,\n nameserver,\n ip,\n oldIp,\n });\n\n return response.commandResponse.domainNsUpdateResult;\n }\n}\n","import type { NamecheapProps } from \"@fwg/types/config.type\";\nimport { request } from \"@fwg/utils/service\";\nimport { CommandsDomainTransfer } from \"@fwg/utils/commands\";\nimport {\n CreateTransferParams,\n GetListTransferParams,\n} from \"@fwg/types/methods/params/domains-transfer-params.type\";\nimport {\n DomainTransferCreateResult,\n DomainTransferGetStatusResult,\n TransferGetResult,\n} from \"@fwg/types/methods/response/domains-transfer.type\";\nimport { Paging } from \"@fwg/types/methods/base.type\";\nimport { DomainTransferListType, DomainTransferSortBy } from \"@fwg/types/enum\";\n\nexport class DomainsTransfer {\n private readonly config: NamecheapProps;\n\n constructor(config: NamecheapProps) {\n this.config = config;\n }\n\n async create(\n domain: string,\n params: Omit<CreateTransferParams, \"domainName\">,\n ): Promise<DomainTransferCreateResult> {\n const response = await request(this.config, CommandsDomainTransfer.Create, {\n domainName: domain,\n ...params,\n });\n return response.commandResponse.domainTransferCreateResult;\n }\n\n async getStatus(id: number): Promise<DomainTransferGetStatusResult> {\n const response = await request(this.config, CommandsDomainTransfer.GetStatus, {\n transferID: id,\n });\n\n return response.commandResponse.domainTransferGetStatusResult;\n }\n\n async updateStatus(id: number, resubmit: boolean): Promise<number> {\n const response = await request(this.config, CommandsDomainTransfer.UpdateStatus, {\n transferID: id,\n resubmit,\n });\n\n return response.commandResponse.domainTransferUpdateStatusResult;\n }\n\n async getList(\n params: GetListTransferParams = {\n listType: DomainTransferListType.All,\n page: 1,\n pageSize: 10,\n sortBy: DomainTransferSortBy.DomainName,\n },\n ): Promise<{\n data: Array<TransferGetResult>;\n paging: Paging;\n }> {\n const response = await request(this.config, CommandsDomainTransfer.GetList, params);\n\n return {\n data: response.commandResponse.transferGetListResult,\n paging: response.commandResponse.paging,\n };\n }\n}\n","import { NamecheapProps } from \"@fwg/types/config.type\";\nimport {\n ActivateSSLParams,\n CreateSSLParams,\n EditDCVMethodParams,\n GetListSSLParams,\n ReissueSSLParams,\n RenewSSLParams,\n} from \"@fwg/types/methods/params/ssl-params.type\";\nimport { request, requestPost } from \"@fwg/utils/service\";\nimport { CommandsSSL } from \"@fwg/utils/commands\";\nimport {\n GetApproverEmailListResult,\n SSLActivateResult,\n SSLCreateResult,\n SSLEditDcvMethodResult,\n SSLGetInfoResult,\n SSLParseCsrResult,\n SSLPurchaseMoreSansResult,\n SSLRenewResult,\n SSLResult,\n} from \"@fwg/types/methods/response/ssl.type\";\nimport { SSLType } from \"@fwg/types/enum\";\n\nexport class SSL {\n private readonly config: NamecheapProps;\n\n constructor(config: NamecheapProps) {\n this.config = config;\n }\n\n async create(params: CreateSSLParams): Promise<SSLCreateResult> {\n const response = await request(this.config, CommandsSSL.Create, params);\n return response.commandResponse.sslCreateResult;\n }\n\n async getList(params: GetListSSLParams): Promise<Array<SSLResult>> {\n const response = await request(this.config, CommandsSSL.GetList, params);\n return response.commandResponse.sslListResult;\n }\n\n async parseCSR(csr: string, certificateType?: SSLType): Promise<SSLParseCsrResult> {\n const response = await requestPost(this.config, CommandsSSL.ParseCRS, {\n csr,\n certificateType,\n });\n\n return response.commandResponse.sslParseCsrResult;\n }\n\n async getApproverEmailList(\n domainName: string,\n certificateType?: SSLType,\n ): Promise<GetApproverEmailListResult> {\n const response = await request(this.config, CommandsSSL.GetApproverEmailList, {\n domainName,\n certificateType,\n });\n return response.commandResponse.getApproverEmailListResult;\n }\n\n async activate(\n certificateId: number,\n params: Omit<ActivateSSLParams, \"certificateId\">,\n ): Promise<SSLActivateResult> {\n const response = await request(this.config, CommandsSSL.Activate, {\n certificateId,\n ...params,\n });\n\n return response.commandResponse.sslActivateResult;\n }\n\n async resendApproverEmail(certificateId: number): Promise<number> {\n const response = await request(this.config, CommandsSSL.ResendApproverEmail, {\n certificateId,\n });\n\n return response.commandResponse.sslResendApproverEmailResult;\n }\n\n async getInfo(certificateId: number): Promise<SSLGetInfoResult> {\n const response = await request(this.config, CommandsSSL.GetInfo, {\n certificateId,\n });\n\n return response.commandResponse.sslGetInfoResult;\n }\n\n async renew(\n certificateId: number,\n params: Omit<RenewSSLParams, \"certificateId\">,\n ): Promise<SSLRenewResult> {\n const response = await request(this.config, CommandsSSL.Renew, {\n certificateId,\n ...params,\n });\n\n return response.commandResponse.sslRenewResult;\n }\n\n async reissue(\n certificateId: number,\n params: Omit<ReissueSSLParams, \"certificateId\">,\n ): Promise<SSLActivateResult> {\n const response = await request(this.config, CommandsSSL.Reissue, {\n certificateId,\n ...params,\n });\n\n return response.commandResponse.sslActivateResult;\n }\n\n async resendFulfillmentEmail(certificateId: number): Promise<number> {\n const response = await request(this.config, CommandsSSL.ResendFulfillmentEmail, {\n certificateId,\n });\n\n return response.commandResponse.sslResendFulfillmentEmailResult;\n }\n\n async purchaseMoreSANS(\n certificateId: number,\n numberOfSANSToAdd: number,\n ): Promise<SSLPurchaseMoreSansResult> {\n const response = await request(this.config, CommandsSSL.PurchaseMoreSANS, {\n certificateId,\n numberOfSANSToAdd,\n });\n\n return response.commandResponse.sslPurchaseMoreSansResult;\n }\n\n async revokeCertificate(certificateId: number, certificateType: SSLType): Promise<number> {\n const response = await request(this.config, CommandsSSL.RevokeCertificate, {\n certificateId,\n certificateType,\n });\n\n return response.commandResponse.revokeCertificateResult;\n }\n\n async editDCVMethod(\n certificateId: number,\n params: Omit<EditDCVMethodParams, \"certificateId\">,\n ): Promise<SSLEditDcvMethodResult> {\n const response = await request(this.config, CommandsSSL.EditDCVMethod, {\n certificateId,\n ...params,\n });\n\n return response.commandResponse.sslEditDcvMethodResult;\n }\n}\n","import { NamecheapProps } from \"@fwg/types/config.type\";\nimport {\n CreateAddFundsRequestParams,\n CreateUserParams,\n GetPricingUserParams,\n ResetPasswordParams,\n UpdateParams,\n} from \"@fwg/types/methods/params/users-params.type\";\nimport { request } from \"@fwg/utils/service\";\nimport { CommandsUser } from \"@fwg/utils/commands\";\nimport {\n GetAddFundsStatusResult,\n UserCreateAddFundsRequest,\n UserGetBalancesResult,\n UserGetPricingResult,\n} from \"@fwg/types/methods/response/users.type\";\n\nexport class Users {\n private readonly config: NamecheapProps;\n\n constructor(config: NamecheapProps) {\n this.config = config;\n }\n\n async getPricing(params: GetPricingUserParams): Promise<UserGetPricingResult> {\n const response = await request(this.config, CommandsUser.GetPricing, params);\n return response.commandResponse.userGetPricingResult;\n }\n\n async getBalances(): Promise<UserGetBalancesResult> {\n const response = await request(this.config, CommandsUser.GetBalances);\n return response.commandResponse.userGetBalancesResult;\n }\n\n async changePassword(oldPassword: string, newPassword: string): Promise<string> {\n const response = await request(this.config, CommandsUser.ChangePassword, {\n oldPassword,\n newPassword,\n });\n return response.commandResponse.userChangePasswordResult;\n }\n\n async update(params: UpdateParams): Promise<string> {\n const response = await request(this.config, CommandsUser.Update, params);\n return response.commandResponse.userUpdateResult;\n }\n\n async createAddFundsRequest(\n username: string,\n params: Omit<CreateAddFundsRequestParams, \"username\">,\n ): Promise<UserCreateAddFundsRequest> {\n const response = await request(this.config, CommandsUser.CreateAddFundsRequest, {\n ...params,\n username,\n });\n\n return response.commandResponse.createaddfundsrequestresult;\n }\n\n async getAddFundsStatus(tokenId: string): Promise<GetAddFundsStatusResult> {\n const response = await request(this.config, CommandsUser.GetAddFundsStatus, {\n tokenId,\n });\n\n return response.commandResponse.getAddFundsStatusResult;\n }\n\n async create(param: CreateUserParams): Promise<number> {\n const response = await request(this.config, CommandsUser.Create, param);\n\n return response.commandResponse.userCreateResult;\n }\n\n async login(password: string): Promise<string> {\n const response = await request(this.config, CommandsUser.Login, {\n password,\n });\n\n return response.commandResponse.userLoginResult;\n }\n\n async resetPassword(params: ResetPasswordParams): Promise<string> {\n const response = await request(this.config, CommandsUser.ResetPassword, params);\n\n return response.commandResponse.userResetPasswordResult;\n }\n}\n","import { NamecheapProps } from \"@fwg/types/config.type\";\nimport { request } from \"@fwg/utils/service\";\nimport { CommandsUserAddress } from \"@fwg/utils/commands\";\nimport {\n AddressCreateResult,\n AddressDeleteResult,\n AddressGetListResult,\n AddressUpdateResult,\n GetAddressInfoResult,\n} from \"@fwg/types/methods/response/users-address.type\";\nimport {\n CreateUserAddressParams,\n UpdateUserAddressParams,\n} from \"@fwg/types/methods/params/users-address-params.type\";\n\nexport class UsersAddress {\n private readonly config: NamecheapProps;\n\n constructor(config: NamecheapProps) {\n this.config = config;\n }\n\n async create(param: CreateUserAddressParams): Promise<AddressCreateResult> {\n const response = await request(this.config, CommandsUserAddress.Create, param);\n return response.commandResponse.addressCreateResult;\n }\n\n async delete(addressId: number): Promise<AddressDeleteResult> {\n const response = await request(this.config, CommandsUserAddress.Delete, {\n addressId,\n });\n\n return response.commandResponse.addressDeleteResult;\n }\n\n async getInfo(addressId: number): Promise<GetAddressInfoResult> {\n const response = await request(this.config, CommandsUserAddress.GetInfo, {\n addressId,\n });\n\n return response.commandResponse.getAddressInfoResult;\n }\n\n async getList(): Promise<AddressGetListResult> {\n const response = await request(this.config, CommandsUserAddress.GetList);\n\n return response.commandResponse.addressGetListResult;\n }\n\n async setDefault(addressId: number): Promise<number> {\n const response = await request(this.config, CommandsUserAddress.SetDefault, {\n addressId,\n });\n\n return response.commandResponse.addressSetDefaultResult;\n }\n\n async update(\n addressId: number,\n params: Omit<UpdateUserAddressParams, \"addressId\">,\n ): Promise<AddressUpdateResult> {\n const response = await request(this.config, CommandsUserAddress.Update, {\n ...params,\n addressId,\n });\n\n return response.commandResponse.addressUpdateResult;\n }\n}\n","import { NamecheapProps } from \"@fwg/types/config.type\";\nimport { request } from \"@fwg/utils/service\";\nimport { CommandsWhoIsGuard } from \"@fwg/utils/commands\";\nimport {\n WhoIsGuardChangeEmailAddressResult,\n WhoIsGuardGetListResult,\n WhoIsGuardRenewResult,\n} from \"@fwg/types/methods/response/whois-guard.type\";\nimport { GetListParams } from \"@fwg/types/methods/params/whois-guard-params.type\";\nimport { Paging } from \"@fwg/types/methods/base.type\";\n\nexport class WhoIsGuard {\n private readonly config: NamecheapProps;\n\n constructor(config: NamecheapProps) {\n this.config = config;\n }\n\n async changeEmailAddress(whoIsGuardId: number): Promise<WhoIsGuardChangeEmailAddressResult> {\n const response = await request(this.config, CommandsWhoIsGuard.ChangeEmailAddress, {\n whoIsGuardId,\n });\n\n return response.commandResponse.whoisguardChangeEmailAddressResult;\n }\n\n async enable(whoIsGuardId: number, forwardedToEmail: string): Promise<string> {\n const response = await request(this.config, CommandsWhoIsGuard.Enable, {\n whoIsGuardId,\n forwardedToEmail,\n });\n\n return response.commandResponse.whoisguardEnableResult;\n }\n\n async disable(whoIsGuardId: number): Promise<string> {\n const response = await request(this.config, CommandsWhoIsGuard.Disable, {\n whoIsGuardId,\n });\n\n return response.commandResponse.whoisguardDisableResult;\n }\n\n async getList(param: GetListParams): Promise<{\n data: Array<WhoIsGuardGetListResult>;\n paging: Paging;\n }> {\n const response = await request(this.config, CommandsWhoIsGuard.GetList, param);\n\n return {\n data: response.commandResponse.whoisguardGetListResult,\n paging: response.commandResponse.paging,\n };\n }\n\n async renew(\n whoIsGuardId: string,\n year: number,\n promotionCode?: number,\n ): Promise<WhoIsGuardRenewResult> {\n const response = await request(this.config, CommandsWhoIsGuard.Renew, {\n whoIsGuardId,\n year,\n prom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T,SAAU,YACV,cAAe,aACf,eAAgB,kBAChB,cAAe,aACf,eAAgB,iBAClB,EAGaC,EAAU,CACrB,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,IAAK,MACL,I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ACgC,CAOhC,OANiB,MAAML,EAAQ,KAAK,oCAAkC,CACpE,aAAAD,EACA,KAAAK,EACA,cAAAC,CACF,CAAC,GAEe,gBAAgB,qBAClC,CACF,EXzDA,IAAqBC,EAArB,KAA+B,CAkB7B,IAAW,eAA4B,CACrC,OAAO,KAAK,UACd,CAEA,YAAYC,EAAoB,CAC9B,GAAM,CAAE,QAAAC,EAAS,OAAAC,EAAQ,SAAAC,EAAU,SAAAC,EAAU,QAAAC,CAAQ,EAAIL,EAEzD,KAAK,QAAUC,EACf,KAAK,OAASC,EACd,KAAK,SAAWC,GAAYF,EAC5B,KAAK,SAAWG,EAChB,KAAK,OAASE,EAAiBD,CAAO,EAEtC,KAAK,QAAU,IAAIE,EAAQ,KAAK,UAAU,CAAC,EAC3C,KAAK,WAAa,IAAIC,EAAW,KAAK,UAAU,CAAC,EACjD,KAAK,UAAY,IAAIC,EAAU,KAAK,UAAU,CAAC,EAC/C,KAAK,gBAAkB,IAAIC,EAAgB,KAAK,UAAU,CAAC,EAC3D,KAAK,IAAM,IAAIC,EAAI,KAAK,UAAU,CAAC,EACnC,KAAK,MAAQ,IAAIC,EAAM,KAAK,UAAU,CAAC,EACvC,KAAK,aAAe,IAAIC,EAAa,KAAK,UAAU,CAAC,EACrD,KAAK,WAAa,IAAIC,EAAW,KAAK,UAAU,CAAC,CACnD,CAEQ,WAA4B,CAClC,MAAO,CACL,QAAS,KAAK,QACd,OAAQ,KAAK,OACb,SAAU,KAAK,SACf,SAAU,KAAK,SACf,OAAQ,KAAK,MACf,CACF,CACF","names":["index_exports","__export","DomainListSortBy","DomainListType","DomainTransferListType","DomainTransferSortBy","EmailType","GetAddFundsStatus","IdnCode","LockAction","RecordType","SSLListSortBy","SSLListType","SSLType","UserActionName","UserListFindBy","UserPaymentType","UserProductCategory","UserProductName","UserProductType","WhoIsListType","Namecheap","__toCommonJS","import_fast_xml_parser","import_change_case_all","simplifyObject","obj","item","keys","key","keyWithValue","acc","newKey","simplifiedValue","getNamecheapHost","isSandbox","checkRequestError","response","flattenObjectToArray","input","prefix","arrayFormat","result","key","value","capitalizedKey","item","index","tagNamesArray","parser","_tagName","jPath","tagName","attributeName","request","namecheapProps","command","params","apiUser","apiKey","apiUrl","username","clientIp","url","xmlData","parsedValue","json","simplifyObject","error","requestPost","rootParams","requestValues","body","RecordType","EmailType","LockAction","DomainListType","DomainListSortBy","IdnCode","DomainTransferListType","DomainTransferSortBy","SSLType","SSLListType","SSLListSortBy","UserProductType","UserProductCategory","UserActionName","UserProductName","UserPaymentType","UserListFindBy","WhoIsListType","GetAddFundsStatus","Domains","config","params","DomainListType","response","request","domainName","domain","domains","LockAction","hostName","DomainsDNS","config","sld","tld","request","nameservers","domain","params","hosts","paramsFormatted","acc","host","i","key","value","response","requestPost","DomainsNS","config","sld","tld","nameserver","ip","request","oldIp","DomainsTransfer","config","domain","params","request","id","resubmit","DomainTransferListType","DomainTransferSortBy","response","SSL","config","params","request","csr","certificateType","requestPost","domainName","certificateId","numberOfSANSToAdd","Users","config","params","request","oldPassword","newPassword","username","tokenId","param","password","UsersAddress","config","param","request","addressId","params","WhoIsGuard","config","whoIsGuardId","request","forwardedToEmail","param","response","year","promotionCode","Namecheap","config","apiUser","apiKey","username","clientIp","sandbox","getNamecheapHost","Domains","DomainsDNS","DomainsNS","DomainsTransfer","SSL","Users","UsersAddress","WhoIsGuard"]}