@fwgapps/namecheap 0.4.1 → 0.6.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/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../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","../src/index.ts"],"sourcesContent":["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\nexport const DomainDnsTag = {\n Issue: \"issue\",\n IssueWild: \"issuewild\",\n IODEF: \"iodef\",\n};\nexport type DomainDnsTag = (typeof DomainDnsTag)[keyof typeof DomainDnsTag];\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 /**\n * @constructor initial configuration to use global settings\n * @param {NamecheapProps} config Namecheap credentials\n */\n constructor(config: NamecheapProps) {\n this.config = config;\n }\n\n /**\n * Sets domain to use our default DNS servers.\n * Required for free services like Host record management, URL forwarding, email forwarding, dynamic dns and other value added services.\n * @param {string} sld SLD of the DomainName\n * @param {string} tld TLD of the DomainName\n * @returns {Promise<>string>} Returns the domain name that you are trying to set default nameservers for.\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 /**\n * Sets domain to use custom DNS servers.\n * @note Services like URL forwarding, Email forwarding, Dynamic DNS will not work for domains using custom nameservers\n * @param {string} sld SLD of the DomainName\n * @param {string} tld TLD of the DomainName\n * @param {Array<string>} nameservers A list of name servers to be associated with this domain\n * @returns {Promise<string>} Returns the domain name that you are trying to set custom nameservers for.\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 /**\n * Gets a list of DNS servers associated with the requested domain.\n * @param {string} sld SLD of the DomainName\n * @param {string} tld TLD of the DomainName\n * @returns List of DNS info (see {@link DomainDnsGetListResult})\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 /**\n * Retrieves DNS host record settings for the requested domain.\n * @param {string} sld SLD of the DomainName\n * @param {string} tld TLD of the DomainName\n * @returns DNS host records info (see {@link DomainDnsGetHostsResult})\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 /**\n * Gets email forwarding settings for the requested domain.\n * @param {string} domain Domain name to get settings\n * @returns Email forwarding info (see {@link DomainDnsGetEmailForwardingResult})\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 /**\n * Sets email forwarding for a domain name.\n * @param {string} domain Domain name to set settings\n * @param {SetDNSEmailForwardingParams} params Set mailbox and forwards\n * - mailBox: for which you wish to set email forwarding.\n * - forwardTo: Email address to forward to\n * @example\n * setEmailForwarding(\"mydomain.com\", {\n * mailBox: [\"example@namecheap.com\"],\n * forwardTo: [\"example:example@gmail.com\"]\n * })\n * @returns Return email affected\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 /**\n * Sets DNS host records settings for the requested domain.\n * @note If you set more than 10 hosts the request will be done by POST method otherwise by GET method.\n * @note All host records that are not included into the API call will be deleted, so add them in addition to new host records.\n * @param {string} sld\n * @param {string} tld\n * @param {Omit<\n * SetDNSHostsParams,\n * \"sld\" | \"tld\" | \"address\" | \"hostname\" | \"mxpref\" | \"recordType\" | \"ttl\"\n * > & { hosts: Array<Host> }} params Host record configuration object:\n * - emailType?: The type of email service to use.\n * - MXE: to set up your custom MXE record.\n * - MX: to set up custom MX records of your mail provider.\n * - FWD: to set up MX records for our Free Email Forwarding service.\n * - OX: to set up MX records for our Private Email service.\n * - flag?: Is an unsigned integer between 0 and 255. The flag value is an 8-bit number, the most significant bit of which indicates the criticality of understanding of a record by a CA. It's recommended to use `0`\n * - tag?: A non-zero sequence of US-ASCII letters and numbers in lower case. The tag value can be one of the following values:\n * - issue — specifies the certification authority that is authorized to issue a certificate for the domain name or subdomain record used in the title.\n * - issuewild — specifies the certification authority that is allowed to issue a wildcard certificate for the domain name or subdomain record used in the title. The certificate applies to the domain name or subdomain directly and to all its subdomains.\n * - iodef — specifies the e-mail address or URL (compliant with RFC 5070) a CA should use to notify a client if any issuance policy violation spotted by this CA.\n * - hosts: Array with host properties\n * - hostname: Sub-domain/hostname to create the record for\n * - recordType: Record type to that host, possible values\n * - A\n * - AAAA\n * - ALIAS\n * - CAA\n * - CNAME\n * - MX\n * - MXE\n * - NS\n * - TXT\n * - URL\n * - URL301\n * - FRAME\n * - address: The value for this parameter is based on RecordType. Possible values:\n * - URL\n * - IP address\n * - mxpref?: MX preference for host. Applicable for MX records only.\n * - ttl?: Time to live for all record types.\n * @returns Return host list affected\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 promotionCode,\n });\n\n return response.commandResponse.whoisguardRenewResult;\n }\n}\n","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"],"mappings":"AAAA,OAAS,aAAAA,MAAiB,kBAC1B,OAAS,aAAAC,EAAW,cAAAC,MAAkB,kBCA/B,IAAMC,EAAkBC,GAAkB,CAC/C,GAAI,MAAM,QAAQA,CAAG,EACnB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AU,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":["XMLParser","camelCase","pascalCase","simplifyObject","obj","item","keys","key","keyWithValue","acc","newKey","simplifiedValue","getNamecheapHost","isSandbox","checkRequestError","response","flattenObjectToArray","input","prefix","arrayFormat","result","key","value","capitalizedKey","pascalCase","item","index","tagNamesArray","parser","XMLParser","_tagName","jPath","tagName","camelCase","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","DomainDnsTag","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"]}
1
+ {"version":3,"sources":["../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","../src/index.ts"],"sourcesContent":["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\" ||\n (Object.hasOwnProperty.call(response, \"errors\") &&\n (!!(response as NamecheapXMLParsedFail).errors.number ||\n !!(response as NamecheapXMLParsedFail).errors.value));\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 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\nexport const DomainDnsTag = {\n Issue: \"issue\",\n IssueWild: \"issuewild\",\n IODEF: \"iodef\",\n};\nexport type DomainDnsTag = (typeof DomainDnsTag)[keyof typeof DomainDnsTag];\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 TLD,\n} from \"@fwg/types/methods/response/domains.type\";\nimport type {\n ContactDomainParams,\n CreateDomainParams,\n GetListParams,\n ReactivateDomainParams,\n RenewDomainParams,\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 /**\n * Returns a list of domains for the particular user\n * @note IMPORTANT: Namecheap API privacy service provider recently changed to WithheldforPrivacy. We want to avoid service interruption for namecheap API users, so please note that in some cases, you may still see Whoisguard in the API parameter names.\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 /**\n * Gets contact information for the requested domain\n * @note IMPORTANT: Namecheap API privacy service provider recently changed to WithheldforPrivacy. We want to avoid service interruption for our API users, so please note that in some cases, you may still see Whoisguard in the API parameter names.\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 * Registers a new domain\n * @note IMPORTANT: Namecheap API privacy service provider recently changed to WithheldforPrivacy. We want to avoid service interruption for our API users, so please note that in some cases, you may still see Whoisguard in the API parameter names.\n * @note For successful registration of an IDN domain, you need to send the IdnCode parameter and provide the domain name in the Punycode format (Example: xn--sdkhjsdhfkdh.com), as we do not support native code.\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 /**\n * Returns a list of TLDs\n * @note IMPORTANT: Namecheap API privacy service provider recently changed to WithheldforPrivacy. We want to avoid service interruption for our API users, so please note that in some cases, you may still see Whoisguard in the API parameter names.\n * @note We strongly recommend that you cache this API response to avoid repeated calls.\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 /**\n * Sets contact information for the requested domain\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 /**\n * Checks the availability of domains\n */\n async check(domains: Array<string>): Promise<Array<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 an expired domain\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 /**\n * Renews an expiring domain\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 /**\n * Gets the Registrar Lock status for the requested domain\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 domain\n */\n async setRegistrarLock(\n domain: string,\n lockAction: LockAction = LockAction.Lock,\n ): Promise<string> {\n const response = await request(this.config, CommandsDomain.SetRegistrarLock, {\n domainName: domain,\n lockAction,\n });\n\n return response.commandResponse.domainSetRegistrarLockResult;\n }\n\n /**\n * Returns information about the requested domain\n * @note IMPORTANT: Namecheap API privacy service provider recently changed to WithheldforPrivacy. We want to avoid service interruption for Namecheap API users, so please note that in some cases, you may still see Whoisguard in the API parameter names.\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 /**\n * Sets domain to use namecheap api default DNS servers.\n * Required for free services like Host record management, URL forwarding, email forwarding, dynamic dns and other value added services.\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 /**\n * Sets domain to use custom DNS servers.\n * @note Services like URL forwarding, Email forwarding, Dynamic DNS will not work for domains using custom nameservers\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 /**\n * Gets a list of DNS servers associated with the requested domain.\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 /**\n * Retrieves DNS host record settings for the requested domain.\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 /**\n * Gets email forwarding settings for the requested domain.\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 /**\n * Sets email forwarding for a domain name.\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 /**\n * Sets DNS host records settings for the requested domain.\n * @note If you set more than 10 hosts the request will be done by POST method otherwise by GET method.\n * @note All host records that are not included into the API call will be deleted, so add them in addition to new host records.\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 promotionCode,\n });\n\n return response.commandResponse.whoisguardRenewResult;\n }\n}\n","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"],"mappings":"AAAA,OAAS,aAAAA,MAAiB,kBAC1B,OAAS,aAAAC,EAAW,cAAAC,MAAkB,kBCA/B,IAAMC,EAAkBC,GAAkB,CAC/C,GAAI,MAAM,QAAQA,CAAG,EACnB,OAAOA,EACJ,IAAID,CAAc,EAClB,OAAQE,GAASA,GAAS,MAA8BA,IAAS,EAAE,EACjE,GAAI,OAAOD,GAAQ,UAAYA,IAAQ,KAAM,CAClD,IAAME,EAAO,OAAO,KAAKF,CAAG,EAE5B,GACEE,EAAK,SAAW,GAChBA,EAAK,SAAS,OAAO,GACrBA,EAAK,KAAMC,GAAQA,IAAQ,SAAWH,EAAIG,CAAG,IAAM,EAAI,EAEvD,OAAOH,EAAI,OAAO,EAGpB,GAAIE,EAAK,SAAW,GAAKA,EAAK,KAAMC,GAAQH,EAAIG,CAAG,IAAM,EAAI,EAAG,CAC9D,IAAMC,EAAeF,EAAK,KAAMC,GAAQH,EAAIG,CAAG,IAAM,EAAI,EACzD,OAAOJ,EAAeC,EAAII,CAAa,CAAC,CAC1C,CAEA,OAAO,OAAO,KAAKJ,CAAG,EAAE,OACtB,CAACK,EAAKF,IAAQ,CACZ,IAAMG,EAASH,IAAQ,QAAU,QAAUA,EACrCI,EAAkBR,EAAeC,E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CACvB,IAAK,MACL,GAAI,KACJ,IAAK,MACL,GAAI,IACN,EAGaC,EAAa,CACxB,KAAM,OACN,OAAQ,QACV,EAGaC,EAAiB,CAC5B,IAAK,MACL,SAAU,WACV,QAAS,SACX,EAGaC,EAAmB,CAC9B,QAAS,OACT,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,MAC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newKey","simplifiedValue","getNamecheapHost","isSandbox","checkRequestError","response","flattenObjectToArray","input","prefix","arrayFormat","result","key","value","capitalizedKey","pascalCase","item","index","tagNamesArray","parser","XMLParser","_tagName","jPath","tagName","camelCase","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","DomainDnsTag","Domains","config","params","DomainListType","response","request","domainName","domain","domains","lockAction","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"]}
package/package.json CHANGED
@@ -1,14 +1,17 @@
1
1
  {
2
2
  "name": "@fwgapps/namecheap",
3
3
  "type": "module",
4
- "version": "0.4.1",
4
+ "version": "0.6.0",
5
5
  "main": "dist/index.cjs",
6
- "module": "dist/index.mjs",
6
+ "module": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
8
+ "unpkg": "dist/index.global.js",
9
+ "jsdelivr": "dist/index.global.js",
8
10
  "scripts": {
9
11
  "clean": "rm -rf dist",
10
12
  "build": "yarn clean && tsup",
11
13
  "test": "vitest",
14
+ "coverage": "vitest run --coverage",
12
15
  "lint": "eslint 'src/**/*.{ts,tsx}' 'tests/**/*.{ts,tsx}'",
13
16
  "lint:fix": "eslint 'src/**/*.{ts,tsx}' 'tests/**/*.{ts,tsx}' --fix",
14
17
  "format": "prettier --write 'src/**/*.{ts,tsx}' 'tests/**/*.{ts,tsx}'",
@@ -45,21 +48,24 @@
45
48
  "@semantic-release/npm": "^12.0.1",
46
49
  "@semantic-release/release-notes-generator": "^14.0.3",
47
50
  "@types/node": "^22.13.11",
48
- "@typescript-eslint/eslint-plugin": "^8.28.0",
49
- "@typescript-eslint/parser": "^8.28.0",
51
+ "@typescript-eslint/eslint-plugin": "^8.33.0",
52
+ "@typescript-eslint/parser": "^8.33.0",
53
+ "@typescript-eslint/utils": "^8.33.0",
50
54
  "@vitest/coverage-v8": "^3.1.4",
51
55
  "cz-conventional-changelog": "^3.3.0",
52
56
  "eslint": "^9.27.0",
53
57
  "eslint-config-prettier": "^10.1.5",
58
+ "eslint-flat-config-utils": "^2.1.0",
54
59
  "eslint-plugin-prettier": "^5.4.0",
55
- "husky": "^8.0.0",
60
+ "husky": "^9.1.7",
56
61
  "lint-staged": "^16.0.0",
57
62
  "prettier": "^3.5.3",
58
63
  "semantic-release": "^24.2.4",
59
64
  "ts-node": "^10.9.2",
60
65
  "ts-node-dev": "^2.0.0",
61
66
  "tsup": "^8.4.0",
62
- "typescript": "^5.8.2",
67
+ "typescript": "^5.8.3",
68
+ "typescript-eslint": "^8.33.0",
63
69
  "vite-tsconfig-paths": "^5.1.4",
64
70
  "vitest": "^3.1.4"
65
71
  },