namecheap-ts 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +51 -4
- package/dist/index.d.mts +79 -5
- package/dist/index.d.ts +79 -5
- package/dist/index.js +122 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +117 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -2,13 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
A TypeScript package that provides a simple and intuitive interface to interact with Namecheap API.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
You can install the package using npm. Run the following command in your terminal:
|
|
6
8
|
|
|
7
9
|
```shell
|
|
8
10
|
npm install namecheap-ts
|
|
9
11
|
```
|
|
10
12
|
|
|
11
|
-
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
You can use the package to perform various operations such as domain registration, DNS management, SSL certificate management, and more. Here's an example of how to use the package to check whether the domain name is available or not:
|
|
12
16
|
|
|
13
17
|
```typescript
|
|
14
18
|
import Namecheap, { INamecheapConfig } from "namecheap-ts";
|
|
@@ -28,10 +32,53 @@ const isAvailabe = data[0].DomainCheckResult[0].$.Available;
|
|
|
28
32
|
console.log(isAvailable);
|
|
29
33
|
```
|
|
30
34
|
|
|
31
|
-
|
|
35
|
+
## API
|
|
36
|
+
|
|
37
|
+
The `Namecheap` class is the main entry point for interacting with the Namecheap API.
|
|
38
|
+
|
|
39
|
+
#### `constructor(config: INamecheapConfig, sandbox?: boolean)`
|
|
40
|
+
|
|
41
|
+
Create a new instance of the `Namecheap` class.
|
|
42
|
+
|
|
43
|
+
```typescript
|
|
44
|
+
const namecheap = new Namecheap(config, true);
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
#### `call(command: Command, payload: Record<string, string>): Promise<IReponse>`
|
|
48
|
+
|
|
49
|
+
Call a command on the Namecheap API.
|
|
32
50
|
|
|
33
51
|
```typescript
|
|
34
|
-
|
|
52
|
+
import { Commands } from "namecheap-ts";
|
|
53
|
+
const response = await namecheap.call(Commands.DOMAINS_CHECK, {
|
|
54
|
+
DomainList: "example.com",
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
console.log(response);
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
#### `checkDomain(domainName: string): Promise<ICheckDomainResponse>`
|
|
61
|
+
|
|
62
|
+
Check if a domain is available and if it'is premium.
|
|
63
|
+
|
|
64
|
+
```typescript
|
|
65
|
+
const { availabe, premium } = await namecheap.checkDomain("example.com");
|
|
66
|
+
|
|
67
|
+
console.log({ availabe, premium });
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
#### `getDomainPrice(domainName: string, action: DomainPriceAction): Promise<IReponse>`
|
|
71
|
+
|
|
72
|
+
Get the price of a domain.
|
|
73
|
+
|
|
74
|
+
```typescript
|
|
75
|
+
import { DomainPriceAction } from "namecheap-ts";
|
|
76
|
+
const response = await namecheap.getDomainPrice(
|
|
77
|
+
"example.com",
|
|
78
|
+
DomainPriceAction.REGISTER
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
console.log(response);
|
|
35
82
|
```
|
|
36
83
|
|
|
37
84
|
You can refer to the official Namecheap API documentation for more information on the available methods and parameters. [The documentation is available at ¹](https://www.namecheap.com/support/api/intro/).
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,73 @@
|
|
|
1
|
-
declare
|
|
2
|
-
|
|
1
|
+
declare enum Commands {
|
|
2
|
+
DOMAINS_GETLIST = "namecheap.domains.getList",
|
|
3
|
+
DOMAINS_GETCONTACTS = "namecheap.domains.getContacts",
|
|
4
|
+
DOMAINS_CREATE = "namecheap.domains.create",
|
|
5
|
+
DOMAINS_GETTLDLIST = "namecheap.domains.getTldList",
|
|
6
|
+
DOMAINS_SETCONTACTS = "namecheap.domains.setContacts",
|
|
7
|
+
DOMAINS_CHECK = "namecheap.domains.check",
|
|
8
|
+
DOMAINS_REACTIVATE = "namecheap.domains.reactivate",
|
|
9
|
+
DOMAINS_RENEW = "namecheap.domains.renew",
|
|
10
|
+
DOMAINS_GETREGISTRARLOCK = "namecheap.domains.getRegistrarLock",
|
|
11
|
+
DOMAINS_SETREGISTRARLOCK = "namecheap.domains.setRegistrarLock",
|
|
12
|
+
DOMAINS_GETINFO = "namecheap.domains.getInfo",
|
|
13
|
+
DOMAINS_DNS_SETDEFAULT = "namecheap.domains.dns.setDefault",
|
|
14
|
+
DOMAINS_DNS_SETCUSTOM = "namecheap.domains.dns.setCustom",
|
|
15
|
+
DOMAINS_DNS_GETLIST = "namecheap.domains.dns.getList",
|
|
16
|
+
DOMAINS_DNS_GETHOSTS = "namecheap.domains.dns.getHosts",
|
|
17
|
+
DOMAINS_DNS_GETEMAILFORWARDING = "namecheap.domains.dns.getEmailForwarding",
|
|
18
|
+
DOMAINS_DNS_SETEMAILFORWARDING = "namecheap.domains.dns.setEmailForwarding",
|
|
19
|
+
DOMAINS_DNS_SETHOSTS = "namecheap.domains.dns.setHosts",
|
|
20
|
+
DOMAINS_NS_CREATE = "namecheap.domains.ns.create",
|
|
21
|
+
DOMAINS_NS_DELETE = "namecheap.domains.ns.delete",
|
|
22
|
+
DOMAINS_NS_GETINFO = "namecheap.domains.ns.getInfo",
|
|
23
|
+
DOMAINS_NS_UPDATE = "namecheap.domains.ns.update",
|
|
24
|
+
DOMAINS_TRANSFER_CREATE = "namecheap.domains.transfer.create",
|
|
25
|
+
DOMAINS_TRANSFER_GETSTATUS = "namecheap.domains.transfer.getStatus",
|
|
26
|
+
DOMAINS_TRANSFER_UPDATESTATUS = "namecheap.domains.transfer.updateStatus",
|
|
27
|
+
DOMAINS_TRANSFER_GETLIST = "namecheap.domains.transfer.getList",
|
|
28
|
+
SSL_CREATE = "namecheap.ssl.create",
|
|
29
|
+
SSL_GETLIST = "namecheap.ssl.getList",
|
|
30
|
+
SSL_PARSECSR = "namecheap.ssl.parseCSR",
|
|
31
|
+
SSL_GETAPPROVEREMAILLIST = "namecheap.ssl.getApproverEmailList",
|
|
32
|
+
SSL_ACTIVATE = "namecheap.ssl.activate",
|
|
33
|
+
SSL_RESENDAPPROVEREMAIL = "namecheap.ssl.resendApproverEmail",
|
|
34
|
+
SSL_GETINFO = "namecheap.ssl.getInfo",
|
|
35
|
+
SSL_RENEW = "namecheap.ssl.renew",
|
|
36
|
+
SSL_REISSUE = "namecheap.ssl.reissue",
|
|
37
|
+
SSL_RESENDFULFILLMENTEMAIL = "namecheap.ssl.resendfulfillmentemail",
|
|
38
|
+
SSL_PURCHASEMORESANS = "namecheap.ssl.purchasemoresans",
|
|
39
|
+
SSL_REVOKECERTIFICATE = "namecheap.ssl.revokecertificate",
|
|
40
|
+
SSL_EDITDCVMETHOD = "namecheap.ssl.editDCVMethod",
|
|
41
|
+
USERS_GETPRICING = "namecheap.users.getPricing",
|
|
42
|
+
USERS_GETBALANCES = "namecheap.users.getBalances",
|
|
43
|
+
USERS_CHANGEPASSWORD = "namecheap.users.changePassword",
|
|
44
|
+
USERS_UPDATE = "namecheap.users.update",
|
|
45
|
+
USERS_CREATEADDFUNDSREQUEST = "namecheap.users.createaddfundsrequest",
|
|
46
|
+
USERS_GETADDFUNDSSTATUS = "namecheap.users.getAddFundsStatus",
|
|
47
|
+
USERS_CREATE = "namecheap.users.create",
|
|
48
|
+
USERS_LOGIN = "namecheap.users.login",
|
|
49
|
+
USERS_RESETPASSWORD = "namecheap.users.resetPassword",
|
|
50
|
+
USERS_ADDRESS_CREATE = "namecheap.users.address.create",
|
|
51
|
+
USERS_ADDRESS_DELETE = "namecheap.users.address.delete",
|
|
52
|
+
USERS_ADDRESS_GETINFO = "namecheap.users.address.getInfo",
|
|
53
|
+
USERS_ADDRESS_GETLIST = "namecheap.users.address.getList",
|
|
54
|
+
USERS_ADDRESS_SETDEFAULT = "namecheap.users.address.setDefault",
|
|
55
|
+
USERS_ADDRESS_UPDATE = "namecheap.users.address.update",
|
|
56
|
+
WHOISGUARD_CHANGEEMAILADDRESS = "Namecheap.Whoisguard.changeemailaddress",
|
|
57
|
+
WHOISGUARD_ENABLE = "Namecheap.Whoisguard.enable",
|
|
58
|
+
WHOISGUARD_DISABLE = "Namecheap.Whoisguard.disable",
|
|
59
|
+
WHOISGUARD_GETLIST = "Namecheap.Whoisguard.getList",
|
|
60
|
+
WHOISGUARD_RENEW = "Namecheap.Whoisguard.renew"
|
|
61
|
+
}
|
|
62
|
+
type Command = `${Commands}`;
|
|
63
|
+
|
|
64
|
+
declare enum DomainPriceActions {
|
|
65
|
+
REGISTER = "REGISTER",
|
|
66
|
+
RENEW = "RENEW",
|
|
67
|
+
REACTIVATE = "REACTIVATE",
|
|
68
|
+
TRANSFER = "TRANSFER"
|
|
69
|
+
}
|
|
70
|
+
type DomainPriceAction = `${DomainPriceActions}`;
|
|
3
71
|
|
|
4
72
|
interface INamecheapConfig {
|
|
5
73
|
ApiUser: string;
|
|
@@ -7,15 +75,21 @@ interface INamecheapConfig {
|
|
|
7
75
|
UserName: string;
|
|
8
76
|
ClientIp: string;
|
|
9
77
|
}
|
|
10
|
-
interface
|
|
78
|
+
interface IReponse {
|
|
11
79
|
data: any;
|
|
12
80
|
status: number;
|
|
13
81
|
}
|
|
82
|
+
interface ICheckDomainResponse {
|
|
83
|
+
availabe: boolean;
|
|
84
|
+
premium: boolean;
|
|
85
|
+
}
|
|
14
86
|
declare class Namecheap {
|
|
15
87
|
private readonly config;
|
|
16
88
|
private readonly apiClient;
|
|
17
89
|
constructor(config: INamecheapConfig, sandbox?: boolean);
|
|
18
|
-
call(command:
|
|
90
|
+
call(command: Command, payload: Record<string, string>): Promise<IReponse>;
|
|
91
|
+
checkDomain(domainName: string): Promise<ICheckDomainResponse>;
|
|
92
|
+
getDomainPrice(domainName: string, action: DomainPriceAction): Promise<IReponse>;
|
|
19
93
|
}
|
|
20
94
|
|
|
21
|
-
export {
|
|
95
|
+
export { Command, Commands, DomainPriceAction, DomainPriceActions, ICheckDomainResponse, INamecheapConfig, IReponse, Namecheap as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,73 @@
|
|
|
1
|
-
declare
|
|
2
|
-
|
|
1
|
+
declare enum Commands {
|
|
2
|
+
DOMAINS_GETLIST = "namecheap.domains.getList",
|
|
3
|
+
DOMAINS_GETCONTACTS = "namecheap.domains.getContacts",
|
|
4
|
+
DOMAINS_CREATE = "namecheap.domains.create",
|
|
5
|
+
DOMAINS_GETTLDLIST = "namecheap.domains.getTldList",
|
|
6
|
+
DOMAINS_SETCONTACTS = "namecheap.domains.setContacts",
|
|
7
|
+
DOMAINS_CHECK = "namecheap.domains.check",
|
|
8
|
+
DOMAINS_REACTIVATE = "namecheap.domains.reactivate",
|
|
9
|
+
DOMAINS_RENEW = "namecheap.domains.renew",
|
|
10
|
+
DOMAINS_GETREGISTRARLOCK = "namecheap.domains.getRegistrarLock",
|
|
11
|
+
DOMAINS_SETREGISTRARLOCK = "namecheap.domains.setRegistrarLock",
|
|
12
|
+
DOMAINS_GETINFO = "namecheap.domains.getInfo",
|
|
13
|
+
DOMAINS_DNS_SETDEFAULT = "namecheap.domains.dns.setDefault",
|
|
14
|
+
DOMAINS_DNS_SETCUSTOM = "namecheap.domains.dns.setCustom",
|
|
15
|
+
DOMAINS_DNS_GETLIST = "namecheap.domains.dns.getList",
|
|
16
|
+
DOMAINS_DNS_GETHOSTS = "namecheap.domains.dns.getHosts",
|
|
17
|
+
DOMAINS_DNS_GETEMAILFORWARDING = "namecheap.domains.dns.getEmailForwarding",
|
|
18
|
+
DOMAINS_DNS_SETEMAILFORWARDING = "namecheap.domains.dns.setEmailForwarding",
|
|
19
|
+
DOMAINS_DNS_SETHOSTS = "namecheap.domains.dns.setHosts",
|
|
20
|
+
DOMAINS_NS_CREATE = "namecheap.domains.ns.create",
|
|
21
|
+
DOMAINS_NS_DELETE = "namecheap.domains.ns.delete",
|
|
22
|
+
DOMAINS_NS_GETINFO = "namecheap.domains.ns.getInfo",
|
|
23
|
+
DOMAINS_NS_UPDATE = "namecheap.domains.ns.update",
|
|
24
|
+
DOMAINS_TRANSFER_CREATE = "namecheap.domains.transfer.create",
|
|
25
|
+
DOMAINS_TRANSFER_GETSTATUS = "namecheap.domains.transfer.getStatus",
|
|
26
|
+
DOMAINS_TRANSFER_UPDATESTATUS = "namecheap.domains.transfer.updateStatus",
|
|
27
|
+
DOMAINS_TRANSFER_GETLIST = "namecheap.domains.transfer.getList",
|
|
28
|
+
SSL_CREATE = "namecheap.ssl.create",
|
|
29
|
+
SSL_GETLIST = "namecheap.ssl.getList",
|
|
30
|
+
SSL_PARSECSR = "namecheap.ssl.parseCSR",
|
|
31
|
+
SSL_GETAPPROVEREMAILLIST = "namecheap.ssl.getApproverEmailList",
|
|
32
|
+
SSL_ACTIVATE = "namecheap.ssl.activate",
|
|
33
|
+
SSL_RESENDAPPROVEREMAIL = "namecheap.ssl.resendApproverEmail",
|
|
34
|
+
SSL_GETINFO = "namecheap.ssl.getInfo",
|
|
35
|
+
SSL_RENEW = "namecheap.ssl.renew",
|
|
36
|
+
SSL_REISSUE = "namecheap.ssl.reissue",
|
|
37
|
+
SSL_RESENDFULFILLMENTEMAIL = "namecheap.ssl.resendfulfillmentemail",
|
|
38
|
+
SSL_PURCHASEMORESANS = "namecheap.ssl.purchasemoresans",
|
|
39
|
+
SSL_REVOKECERTIFICATE = "namecheap.ssl.revokecertificate",
|
|
40
|
+
SSL_EDITDCVMETHOD = "namecheap.ssl.editDCVMethod",
|
|
41
|
+
USERS_GETPRICING = "namecheap.users.getPricing",
|
|
42
|
+
USERS_GETBALANCES = "namecheap.users.getBalances",
|
|
43
|
+
USERS_CHANGEPASSWORD = "namecheap.users.changePassword",
|
|
44
|
+
USERS_UPDATE = "namecheap.users.update",
|
|
45
|
+
USERS_CREATEADDFUNDSREQUEST = "namecheap.users.createaddfundsrequest",
|
|
46
|
+
USERS_GETADDFUNDSSTATUS = "namecheap.users.getAddFundsStatus",
|
|
47
|
+
USERS_CREATE = "namecheap.users.create",
|
|
48
|
+
USERS_LOGIN = "namecheap.users.login",
|
|
49
|
+
USERS_RESETPASSWORD = "namecheap.users.resetPassword",
|
|
50
|
+
USERS_ADDRESS_CREATE = "namecheap.users.address.create",
|
|
51
|
+
USERS_ADDRESS_DELETE = "namecheap.users.address.delete",
|
|
52
|
+
USERS_ADDRESS_GETINFO = "namecheap.users.address.getInfo",
|
|
53
|
+
USERS_ADDRESS_GETLIST = "namecheap.users.address.getList",
|
|
54
|
+
USERS_ADDRESS_SETDEFAULT = "namecheap.users.address.setDefault",
|
|
55
|
+
USERS_ADDRESS_UPDATE = "namecheap.users.address.update",
|
|
56
|
+
WHOISGUARD_CHANGEEMAILADDRESS = "Namecheap.Whoisguard.changeemailaddress",
|
|
57
|
+
WHOISGUARD_ENABLE = "Namecheap.Whoisguard.enable",
|
|
58
|
+
WHOISGUARD_DISABLE = "Namecheap.Whoisguard.disable",
|
|
59
|
+
WHOISGUARD_GETLIST = "Namecheap.Whoisguard.getList",
|
|
60
|
+
WHOISGUARD_RENEW = "Namecheap.Whoisguard.renew"
|
|
61
|
+
}
|
|
62
|
+
type Command = `${Commands}`;
|
|
63
|
+
|
|
64
|
+
declare enum DomainPriceActions {
|
|
65
|
+
REGISTER = "REGISTER",
|
|
66
|
+
RENEW = "RENEW",
|
|
67
|
+
REACTIVATE = "REACTIVATE",
|
|
68
|
+
TRANSFER = "TRANSFER"
|
|
69
|
+
}
|
|
70
|
+
type DomainPriceAction = `${DomainPriceActions}`;
|
|
3
71
|
|
|
4
72
|
interface INamecheapConfig {
|
|
5
73
|
ApiUser: string;
|
|
@@ -7,15 +75,21 @@ interface INamecheapConfig {
|
|
|
7
75
|
UserName: string;
|
|
8
76
|
ClientIp: string;
|
|
9
77
|
}
|
|
10
|
-
interface
|
|
78
|
+
interface IReponse {
|
|
11
79
|
data: any;
|
|
12
80
|
status: number;
|
|
13
81
|
}
|
|
82
|
+
interface ICheckDomainResponse {
|
|
83
|
+
availabe: boolean;
|
|
84
|
+
premium: boolean;
|
|
85
|
+
}
|
|
14
86
|
declare class Namecheap {
|
|
15
87
|
private readonly config;
|
|
16
88
|
private readonly apiClient;
|
|
17
89
|
constructor(config: INamecheapConfig, sandbox?: boolean);
|
|
18
|
-
call(command:
|
|
90
|
+
call(command: Command, payload: Record<string, string>): Promise<IReponse>;
|
|
91
|
+
checkDomain(domainName: string): Promise<ICheckDomainResponse>;
|
|
92
|
+
getDomainPrice(domainName: string, action: DomainPriceAction): Promise<IReponse>;
|
|
19
93
|
}
|
|
20
94
|
|
|
21
|
-
export {
|
|
95
|
+
export { Command, Commands, DomainPriceAction, DomainPriceActions, ICheckDomainResponse, INamecheapConfig, IReponse, Namecheap as default };
|
package/dist/index.js
CHANGED
|
@@ -67,10 +67,85 @@ var __async = (__this, __arguments, generator) => {
|
|
|
67
67
|
// src/index.ts
|
|
68
68
|
var src_exports = {};
|
|
69
69
|
__export(src_exports, {
|
|
70
|
+
Commands: () => Commands,
|
|
71
|
+
DomainPriceActions: () => DomainPriceActions,
|
|
70
72
|
default: () => namecheap_default
|
|
71
73
|
});
|
|
72
74
|
module.exports = __toCommonJS(src_exports);
|
|
73
75
|
|
|
76
|
+
// src/commands.ts
|
|
77
|
+
var Commands = /* @__PURE__ */ ((Commands2) => {
|
|
78
|
+
Commands2["DOMAINS_GETLIST"] = "namecheap.domains.getList";
|
|
79
|
+
Commands2["DOMAINS_GETCONTACTS"] = "namecheap.domains.getContacts";
|
|
80
|
+
Commands2["DOMAINS_CREATE"] = "namecheap.domains.create";
|
|
81
|
+
Commands2["DOMAINS_GETTLDLIST"] = "namecheap.domains.getTldList";
|
|
82
|
+
Commands2["DOMAINS_SETCONTACTS"] = "namecheap.domains.setContacts";
|
|
83
|
+
Commands2["DOMAINS_CHECK"] = "namecheap.domains.check";
|
|
84
|
+
Commands2["DOMAINS_REACTIVATE"] = "namecheap.domains.reactivate";
|
|
85
|
+
Commands2["DOMAINS_RENEW"] = "namecheap.domains.renew";
|
|
86
|
+
Commands2["DOMAINS_GETREGISTRARLOCK"] = "namecheap.domains.getRegistrarLock";
|
|
87
|
+
Commands2["DOMAINS_SETREGISTRARLOCK"] = "namecheap.domains.setRegistrarLock";
|
|
88
|
+
Commands2["DOMAINS_GETINFO"] = "namecheap.domains.getInfo";
|
|
89
|
+
Commands2["DOMAINS_DNS_SETDEFAULT"] = "namecheap.domains.dns.setDefault";
|
|
90
|
+
Commands2["DOMAINS_DNS_SETCUSTOM"] = "namecheap.domains.dns.setCustom";
|
|
91
|
+
Commands2["DOMAINS_DNS_GETLIST"] = "namecheap.domains.dns.getList";
|
|
92
|
+
Commands2["DOMAINS_DNS_GETHOSTS"] = "namecheap.domains.dns.getHosts";
|
|
93
|
+
Commands2["DOMAINS_DNS_GETEMAILFORWARDING"] = "namecheap.domains.dns.getEmailForwarding";
|
|
94
|
+
Commands2["DOMAINS_DNS_SETEMAILFORWARDING"] = "namecheap.domains.dns.setEmailForwarding";
|
|
95
|
+
Commands2["DOMAINS_DNS_SETHOSTS"] = "namecheap.domains.dns.setHosts";
|
|
96
|
+
Commands2["DOMAINS_NS_CREATE"] = "namecheap.domains.ns.create";
|
|
97
|
+
Commands2["DOMAINS_NS_DELETE"] = "namecheap.domains.ns.delete";
|
|
98
|
+
Commands2["DOMAINS_NS_GETINFO"] = "namecheap.domains.ns.getInfo";
|
|
99
|
+
Commands2["DOMAINS_NS_UPDATE"] = "namecheap.domains.ns.update";
|
|
100
|
+
Commands2["DOMAINS_TRANSFER_CREATE"] = "namecheap.domains.transfer.create";
|
|
101
|
+
Commands2["DOMAINS_TRANSFER_GETSTATUS"] = "namecheap.domains.transfer.getStatus";
|
|
102
|
+
Commands2["DOMAINS_TRANSFER_UPDATESTATUS"] = "namecheap.domains.transfer.updateStatus";
|
|
103
|
+
Commands2["DOMAINS_TRANSFER_GETLIST"] = "namecheap.domains.transfer.getList";
|
|
104
|
+
Commands2["SSL_CREATE"] = "namecheap.ssl.create";
|
|
105
|
+
Commands2["SSL_GETLIST"] = "namecheap.ssl.getList";
|
|
106
|
+
Commands2["SSL_PARSECSR"] = "namecheap.ssl.parseCSR";
|
|
107
|
+
Commands2["SSL_GETAPPROVEREMAILLIST"] = "namecheap.ssl.getApproverEmailList";
|
|
108
|
+
Commands2["SSL_ACTIVATE"] = "namecheap.ssl.activate";
|
|
109
|
+
Commands2["SSL_RESENDAPPROVEREMAIL"] = "namecheap.ssl.resendApproverEmail";
|
|
110
|
+
Commands2["SSL_GETINFO"] = "namecheap.ssl.getInfo";
|
|
111
|
+
Commands2["SSL_RENEW"] = "namecheap.ssl.renew";
|
|
112
|
+
Commands2["SSL_REISSUE"] = "namecheap.ssl.reissue";
|
|
113
|
+
Commands2["SSL_RESENDFULFILLMENTEMAIL"] = "namecheap.ssl.resendfulfillmentemail";
|
|
114
|
+
Commands2["SSL_PURCHASEMORESANS"] = "namecheap.ssl.purchasemoresans";
|
|
115
|
+
Commands2["SSL_REVOKECERTIFICATE"] = "namecheap.ssl.revokecertificate";
|
|
116
|
+
Commands2["SSL_EDITDCVMETHOD"] = "namecheap.ssl.editDCVMethod";
|
|
117
|
+
Commands2["USERS_GETPRICING"] = "namecheap.users.getPricing";
|
|
118
|
+
Commands2["USERS_GETBALANCES"] = "namecheap.users.getBalances";
|
|
119
|
+
Commands2["USERS_CHANGEPASSWORD"] = "namecheap.users.changePassword";
|
|
120
|
+
Commands2["USERS_UPDATE"] = "namecheap.users.update";
|
|
121
|
+
Commands2["USERS_CREATEADDFUNDSREQUEST"] = "namecheap.users.createaddfundsrequest";
|
|
122
|
+
Commands2["USERS_GETADDFUNDSSTATUS"] = "namecheap.users.getAddFundsStatus";
|
|
123
|
+
Commands2["USERS_CREATE"] = "namecheap.users.create";
|
|
124
|
+
Commands2["USERS_LOGIN"] = "namecheap.users.login";
|
|
125
|
+
Commands2["USERS_RESETPASSWORD"] = "namecheap.users.resetPassword";
|
|
126
|
+
Commands2["USERS_ADDRESS_CREATE"] = "namecheap.users.address.create";
|
|
127
|
+
Commands2["USERS_ADDRESS_DELETE"] = "namecheap.users.address.delete";
|
|
128
|
+
Commands2["USERS_ADDRESS_GETINFO"] = "namecheap.users.address.getInfo";
|
|
129
|
+
Commands2["USERS_ADDRESS_GETLIST"] = "namecheap.users.address.getList";
|
|
130
|
+
Commands2["USERS_ADDRESS_SETDEFAULT"] = "namecheap.users.address.setDefault";
|
|
131
|
+
Commands2["USERS_ADDRESS_UPDATE"] = "namecheap.users.address.update";
|
|
132
|
+
Commands2["WHOISGUARD_CHANGEEMAILADDRESS"] = "Namecheap.Whoisguard.changeemailaddress";
|
|
133
|
+
Commands2["WHOISGUARD_ENABLE"] = "Namecheap.Whoisguard.enable";
|
|
134
|
+
Commands2["WHOISGUARD_DISABLE"] = "Namecheap.Whoisguard.disable";
|
|
135
|
+
Commands2["WHOISGUARD_GETLIST"] = "Namecheap.Whoisguard.getList";
|
|
136
|
+
Commands2["WHOISGUARD_RENEW"] = "Namecheap.Whoisguard.renew";
|
|
137
|
+
return Commands2;
|
|
138
|
+
})(Commands || {});
|
|
139
|
+
|
|
140
|
+
// src/types.ts
|
|
141
|
+
var DomainPriceActions = /* @__PURE__ */ ((DomainPriceActions2) => {
|
|
142
|
+
DomainPriceActions2["REGISTER"] = "REGISTER";
|
|
143
|
+
DomainPriceActions2["RENEW"] = "RENEW";
|
|
144
|
+
DomainPriceActions2["REACTIVATE"] = "REACTIVATE";
|
|
145
|
+
DomainPriceActions2["TRANSFER"] = "TRANSFER";
|
|
146
|
+
return DomainPriceActions2;
|
|
147
|
+
})(DomainPriceActions || {});
|
|
148
|
+
|
|
74
149
|
// src/api/api-client.ts
|
|
75
150
|
var import_axios = __toESM(require("axios"));
|
|
76
151
|
var import_xml2js = require("xml2js");
|
|
@@ -125,6 +200,14 @@ var APIClient = class {
|
|
|
125
200
|
};
|
|
126
201
|
var api_client_default = APIClient;
|
|
127
202
|
|
|
203
|
+
// src/exceptions/InvalidDomainNameException.ts
|
|
204
|
+
var InvalidDomainNameException = class extends Error {
|
|
205
|
+
constructor(domainName) {
|
|
206
|
+
super(`The provided domain name [${domainName}] is not valid`);
|
|
207
|
+
this.name = "InvalidDomainNameException";
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
|
|
128
211
|
// src/namecheap.ts
|
|
129
212
|
var Namecheap = class {
|
|
130
213
|
constructor(config, sandbox) {
|
|
@@ -134,7 +217,7 @@ var Namecheap = class {
|
|
|
134
217
|
}
|
|
135
218
|
call(command, payload) {
|
|
136
219
|
return __async(this, null, function* () {
|
|
137
|
-
const params = __spreadProps(__spreadValues(__spreadValues({}, this.config),
|
|
220
|
+
const params = __spreadProps(__spreadValues(__spreadValues({}, payload), this.config), {
|
|
138
221
|
command
|
|
139
222
|
});
|
|
140
223
|
const url = "?" + new URLSearchParams(params).toString();
|
|
@@ -142,6 +225,44 @@ var Namecheap = class {
|
|
|
142
225
|
return { data, status };
|
|
143
226
|
});
|
|
144
227
|
}
|
|
228
|
+
checkDomain(domainName) {
|
|
229
|
+
return __async(this, null, function* () {
|
|
230
|
+
const { data } = yield this.call("namecheap.domains.check" /* DOMAINS_CHECK */, {
|
|
231
|
+
DomainList: domainName
|
|
232
|
+
});
|
|
233
|
+
const isAvailabe = data[0].DomainCheckResult[0].$.Available;
|
|
234
|
+
const isPremium = data[0].DomainCheckResult[0].$.IsPremiumName;
|
|
235
|
+
const response = {
|
|
236
|
+
availabe: isAvailabe === "true",
|
|
237
|
+
premium: isPremium === "true"
|
|
238
|
+
};
|
|
239
|
+
return response;
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
getDomainPrice(domainName, action) {
|
|
243
|
+
return __async(this, null, function* () {
|
|
244
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
245
|
+
const [_, tld] = domainName.split(".");
|
|
246
|
+
if (!tld) {
|
|
247
|
+
throw new InvalidDomainNameException(domainName);
|
|
248
|
+
}
|
|
249
|
+
const { data, status } = yield this.call("namecheap.users.getPricing" /* USERS_GETPRICING */, {
|
|
250
|
+
ProductType: "DOMAIN",
|
|
251
|
+
ProductCategory: "DOMAINS",
|
|
252
|
+
ActionName: action,
|
|
253
|
+
ProductName: tld
|
|
254
|
+
});
|
|
255
|
+
const pricing = (_h = (_g = (_f = (_e = (_d = (_c = (_b = (_a = data[0].UserGetPricingResult[0]) == null ? void 0 : _a.ProductType) == null ? void 0 : _b[0]) == null ? void 0 : _c.ProductCategory) == null ? void 0 : _d[0]) == null ? void 0 : _e.Product) == null ? void 0 : _f[0]) == null ? void 0 : _g.Price) == null ? void 0 : _h.map(
|
|
256
|
+
(price) => __spreadValues({}, price.$)
|
|
257
|
+
);
|
|
258
|
+
return { data: pricing, status };
|
|
259
|
+
});
|
|
260
|
+
}
|
|
145
261
|
};
|
|
146
262
|
var namecheap_default = Namecheap;
|
|
263
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
264
|
+
0 && (module.exports = {
|
|
265
|
+
Commands,
|
|
266
|
+
DomainPriceActions
|
|
267
|
+
});
|
|
147
268
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/api/api-client.ts","../src/api/errors.ts","../src/namecheap.ts"],"sourcesContent":["export { default, INamecheapConfig, ICallReponse } from \"./namecheap\";\r\n\r\n// import fs from \"fs\";\r\n\r\n// import NameCheap from \"./namecheap\";\r\n\r\n// const instance = new NameCheap(\r\n// {\r\n// ApiKey: \"d915adb9b0ac405398def53be001110e\",\r\n// ApiUser: \"Kanakri\",\r\n// UserName: \"Kanakri\",\r\n// ClientIp: \"5.155.10.166\",\r\n// },\r\n// true\r\n// );\r\n\r\n// instance\r\n// .call(\"namecheap.domains.check\", {\r\n// DomainList: \"mezoishere.net\",\r\n// })\r\n// .then(({data}) => {\r\n// fs.writeFile(\"data.json\", JSON.stringify(data, null, 2), \"utf8\", (err) => {\r\n// console.log(err);\r\n// });\r\n// console.log({ data });\r\n// })\r\n// .catch((err) => {\r\n// console.log({ err });\r\n// });\r\n","import axios, { AxiosInstance, AxiosResponse } from \"axios\";\r\nimport { parseStringPromise } from \"xml2js\";\r\nimport { ResponseError, XMLParsingError } from \"./errors\";\r\n\r\nclass APIClient {\r\n private readonly _client: AxiosInstance;\r\n constructor(baseURL: string) {\r\n this._client = axios.create({ baseURL });\r\n this._client.interceptors.response.use(this.onResponse);\r\n }\r\n\r\n async get(url: string) {\r\n return await this._client.get(url);\r\n }\r\n\r\n private async onResponse(response: AxiosResponse): Promise<AxiosResponse> {\r\n try {\r\n const result = await parseStringPromise(response.data);\r\n\r\n if (result.ApiResponse.$.Status === \"ERROR\") {\r\n const responseErrors = result.ApiResponse.Errors;\r\n const code = responseErrors[0].Error[0].$.Number;\r\n const message = responseErrors[0].Error[0]._;\r\n\r\n throw new ResponseError(message, code);\r\n }\r\n\r\n response.data = result.ApiResponse.CommandResponse;\r\n } catch (err) {\r\n response.status = 400;\r\n if (err instanceof ResponseError) {\r\n throw err;\r\n }\r\n\r\n throw new XMLParsingError();\r\n }\r\n\r\n return response;\r\n }\r\n}\r\n\r\nexport default APIClient;\r\n","export class XMLParsingError extends Error {\r\n constructor() {\r\n super(\"Invalid XML response\");\r\n\r\n this.name = \"XMLParsingError\";\r\n }\r\n}\r\n\r\nexport class ResponseError extends Error {\r\n constructor(message: string, readonly code?: number) {\r\n super((code ? `${code}: ` : \"\") + message);\r\n\r\n this.name = \"ResponseError\";\r\n }\r\n}\r\n","import APIClient from \"./api\";\r\nimport { ICommand } from \"./commands\";\r\n\r\nexport interface INamecheapConfig {\r\n ApiUser: string;\r\n ApiKey: string;\r\n UserName: string;\r\n ClientIp: string;\r\n}\r\n\r\nexport interface ICallReponse {\r\n data: any;\r\n status: number;\r\n}\r\n\r\nclass Namecheap {\r\n private readonly apiClient: APIClient;\r\n constructor(private readonly config: INamecheapConfig, sandbox?: boolean) {\r\n const baseURL = `https://api${\r\n sandbox ? \".sandbox\" : \"\"\r\n }.namecheap.com/xml.response`;\r\n this.apiClient = new APIClient(baseURL);\r\n }\r\n\r\n async call(\r\n command: ICommand,\r\n payload: Record<string, string>\r\n ): Promise<ICallReponse> {\r\n const params = {\r\n ...this.config,\r\n ...payload,\r\n command,\r\n };\r\n\r\n const url = \"?\" + new URLSearchParams(params).toString();\r\n\r\n const { data, status } = await this.apiClient.get(url);\r\n\r\n return { data, status };\r\n }\r\n}\r\n\r\nexport default Namecheap;\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAAoD;AACpD,oBAAmC;;;ACD5B,IAAM,kBAAN,cAA8B,MAAM;AAAA,EACzC,cAAc;AACZ,UAAM,sBAAsB;AAE5B,SAAK,OAAO;AAAA,EACd;AACF;AAEO,IAAM,gBAAN,cAA4B,MAAM;AAAA,EACvC,YAAY,SAA0B,MAAe;AACnD,WAAO,OAAO,GAAG,IAAI,OAAO,MAAM,OAAO;AADL;AAGpC,SAAK,OAAO;AAAA,EACd;AACF;;;ADVA,IAAM,YAAN,MAAgB;AAAA,EAEd,YAAY,SAAiB;AAC3B,SAAK,UAAU,aAAAA,QAAM,OAAO,EAAE,QAAQ,CAAC;AACvC,SAAK,QAAQ,aAAa,SAAS,IAAI,KAAK,UAAU;AAAA,EACxD;AAAA,EAEM,IAAI,KAAa;AAAA;AACrB,aAAO,MAAM,KAAK,QAAQ,IAAI,GAAG;AAAA,IACnC;AAAA;AAAA,EAEc,WAAW,UAAiD;AAAA;AACxE,UAAI;AACF,cAAM,SAAS,UAAM,kCAAmB,SAAS,IAAI;AAErD,YAAI,OAAO,YAAY,EAAE,WAAW,SAAS;AAC3C,gBAAM,iBAAiB,OAAO,YAAY;AAC1C,gBAAM,OAAO,eAAe,CAAC,EAAE,MAAM,CAAC,EAAE,EAAE;AAC1C,gBAAM,UAAU,eAAe,CAAC,EAAE,MAAM,CAAC,EAAE;AAE3C,gBAAM,IAAI,cAAc,SAAS,IAAI;AAAA,QACvC;AAEA,iBAAS,OAAO,OAAO,YAAY;AAAA,MACrC,SAAS,KAAK;AACZ,iBAAS,SAAS;AAClB,YAAI,eAAe,eAAe;AAChC,gBAAM;AAAA,QACR;AAEA,cAAM,IAAI,gBAAgB;AAAA,MAC5B;AAEA,aAAO;AAAA,IACT;AAAA;AACF;AAEA,IAAO,qBAAQ;;;AE1Bf,IAAM,YAAN,MAAgB;AAAA,EAEd,YAA6B,QAA0B,SAAmB;AAA7C;AAC3B,UAAM,UAAU,cACd,UAAU,aAAa,EACzB;AACA,SAAK,YAAY,IAAI,mBAAU,OAAO;AAAA,EACxC;AAAA,EAEM,KACJ,SACA,SACuB;AAAA;AACvB,YAAM,SAAS,gDACV,KAAK,SACL,UAFU;AAAA,QAGb;AAAA,MACF;AAEA,YAAM,MAAM,MAAM,IAAI,gBAAgB,MAAM,EAAE,SAAS;AAEvD,YAAM,EAAE,MAAM,OAAO,IAAI,MAAM,KAAK,UAAU,IAAI,GAAG;AAErD,aAAO,EAAE,MAAM,OAAO;AAAA,IACxB;AAAA;AACF;AAEA,IAAO,oBAAQ;","names":["axios"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/commands.ts","../src/types.ts","../src/api/api-client.ts","../src/api/errors.ts","../src/exceptions/InvalidDomainNameException.ts","../src/namecheap.ts"],"sourcesContent":["export * from \"./commands\";\r\nexport * from \"./types\";\r\nexport * from \"./namecheap\";\r\nexport { default } from \"./namecheap\";\r\n","export enum Commands {\r\n // domains\r\n DOMAINS_GETLIST = \"namecheap.domains.getList\",\r\n DOMAINS_GETCONTACTS = \"namecheap.domains.getContacts\",\r\n DOMAINS_CREATE = \"namecheap.domains.create\",\r\n DOMAINS_GETTLDLIST = \"namecheap.domains.getTldList\",\r\n DOMAINS_SETCONTACTS = \"namecheap.domains.setContacts\",\r\n DOMAINS_CHECK = \"namecheap.domains.check\",\r\n DOMAINS_REACTIVATE = \"namecheap.domains.reactivate\",\r\n DOMAINS_RENEW = \"namecheap.domains.renew\",\r\n DOMAINS_GETREGISTRARLOCK = \"namecheap.domains.getRegistrarLock\",\r\n DOMAINS_SETREGISTRARLOCK = \"namecheap.domains.setRegistrarLock\",\r\n DOMAINS_GETINFO = \"namecheap.domains.getInfo\",\r\n\r\n // domains.dns\r\n DOMAINS_DNS_SETDEFAULT = \"namecheap.domains.dns.setDefault\",\r\n DOMAINS_DNS_SETCUSTOM = \"namecheap.domains.dns.setCustom\",\r\n DOMAINS_DNS_GETLIST = \"namecheap.domains.dns.getList\",\r\n DOMAINS_DNS_GETHOSTS = \"namecheap.domains.dns.getHosts\",\r\n DOMAINS_DNS_GETEMAILFORWARDING = \"namecheap.domains.dns.getEmailForwarding\",\r\n DOMAINS_DNS_SETEMAILFORWARDING = \"namecheap.domains.dns.setEmailForwarding\",\r\n DOMAINS_DNS_SETHOSTS = \"namecheap.domains.dns.setHosts\",\r\n\r\n // domains.ns\r\n DOMAINS_NS_CREATE = \"namecheap.domains.ns.create\",\r\n DOMAINS_NS_DELETE = \"namecheap.domains.ns.delete\",\r\n DOMAINS_NS_GETINFO = \"namecheap.domains.ns.getInfo\",\r\n DOMAINS_NS_UPDATE = \"namecheap.domains.ns.update\",\r\n\r\n // domains.transfer\r\n DOMAINS_TRANSFER_CREATE = \"namecheap.domains.transfer.create\",\r\n DOMAINS_TRANSFER_GETSTATUS = \"namecheap.domains.transfer.getStatus\",\r\n DOMAINS_TRANSFER_UPDATESTATUS = \"namecheap.domains.transfer.updateStatus\",\r\n DOMAINS_TRANSFER_GETLIST = \"namecheap.domains.transfer.getList\",\r\n\r\n // ssl\r\n SSL_CREATE = \"namecheap.ssl.create\",\r\n SSL_GETLIST = \"namecheap.ssl.getList\",\r\n SSL_PARSECSR = \"namecheap.ssl.parseCSR\",\r\n SSL_GETAPPROVEREMAILLIST = \"namecheap.ssl.getApproverEmailList\",\r\n SSL_ACTIVATE = \"namecheap.ssl.activate\",\r\n SSL_RESENDAPPROVEREMAIL = \"namecheap.ssl.resendApproverEmail\",\r\n SSL_GETINFO = \"namecheap.ssl.getInfo\",\r\n SSL_RENEW = \"namecheap.ssl.renew\",\r\n SSL_REISSUE = \"namecheap.ssl.reissue\",\r\n SSL_RESENDFULFILLMENTEMAIL = \"namecheap.ssl.resendfulfillmentemail\",\r\n SSL_PURCHASEMORESANS = \"namecheap.ssl.purchasemoresans\",\r\n SSL_REVOKECERTIFICATE = \"namecheap.ssl.revokecertificate\",\r\n SSL_EDITDCVMETHOD = \"namecheap.ssl.editDCVMethod\",\r\n\r\n // users\r\n USERS_GETPRICING = \"namecheap.users.getPricing\",\r\n USERS_GETBALANCES = \"namecheap.users.getBalances\",\r\n USERS_CHANGEPASSWORD = \"namecheap.users.changePassword\",\r\n USERS_UPDATE = \"namecheap.users.update\",\r\n USERS_CREATEADDFUNDSREQUEST = \"namecheap.users.createaddfundsrequest\",\r\n USERS_GETADDFUNDSSTATUS = \"namecheap.users.getAddFundsStatus\",\r\n USERS_CREATE = \"namecheap.users.create\",\r\n USERS_LOGIN = \"namecheap.users.login\",\r\n USERS_RESETPASSWORD = \"namecheap.users.resetPassword\",\r\n\r\n // users.address\r\n USERS_ADDRESS_CREATE = \"namecheap.users.address.create\",\r\n USERS_ADDRESS_DELETE = \"namecheap.users.address.delete\",\r\n USERS_ADDRESS_GETINFO = \"namecheap.users.address.getInfo\",\r\n USERS_ADDRESS_GETLIST = \"namecheap.users.address.getList\",\r\n USERS_ADDRESS_SETDEFAULT = \"namecheap.users.address.setDefault\",\r\n USERS_ADDRESS_UPDATE = \"namecheap.users.address.update\",\r\n\r\n // domainprivacy\r\n WHOISGUARD_CHANGEEMAILADDRESS = \"Namecheap.Whoisguard.changeemailaddress\",\r\n WHOISGUARD_ENABLE = \"Namecheap.Whoisguard.enable\",\r\n WHOISGUARD_DISABLE = \"Namecheap.Whoisguard.disable\",\r\n WHOISGUARD_GETLIST = \"Namecheap.Whoisguard.getList\",\r\n WHOISGUARD_RENEW = \"Namecheap.Whoisguard.renew\",\r\n}\r\n\r\nexport type Command = `${Commands}`;\r\n","export enum DomainPriceActions {\r\n REGISTER = \"REGISTER\",\r\n RENEW = \"RENEW\",\r\n REACTIVATE = \"REACTIVATE\",\r\n TRANSFER = \"TRANSFER\",\r\n}\r\n\r\nexport type DomainPriceAction = `${DomainPriceActions}`;\r\n","import axios, { AxiosInstance, AxiosResponse } from \"axios\";\r\nimport { parseStringPromise } from \"xml2js\";\r\nimport { ResponseError, XMLParsingError } from \"./errors\";\r\n\r\nclass APIClient {\r\n private readonly _client: AxiosInstance;\r\n constructor(baseURL: string) {\r\n this._client = axios.create({ baseURL });\r\n this._client.interceptors.response.use(this.onResponse);\r\n }\r\n\r\n async get(url: string) {\r\n return await this._client.get(url);\r\n }\r\n\r\n private async onResponse(response: AxiosResponse): Promise<AxiosResponse> {\r\n try {\r\n const result = await parseStringPromise(response.data);\r\n\r\n if (result.ApiResponse.$.Status === \"ERROR\") {\r\n const responseErrors = result.ApiResponse.Errors;\r\n const code = responseErrors[0].Error[0].$.Number;\r\n const message = responseErrors[0].Error[0]._;\r\n\r\n throw new ResponseError(message, code);\r\n }\r\n\r\n response.data = result.ApiResponse.CommandResponse;\r\n } catch (err) {\r\n response.status = 400;\r\n if (err instanceof ResponseError) {\r\n throw err;\r\n }\r\n\r\n throw new XMLParsingError();\r\n }\r\n\r\n return response;\r\n }\r\n}\r\n\r\nexport default APIClient;\r\n","export class XMLParsingError extends Error {\r\n constructor() {\r\n super(\"Invalid XML response\");\r\n\r\n this.name = \"XMLParsingError\";\r\n }\r\n}\r\n\r\nexport class ResponseError extends Error {\r\n constructor(message: string, readonly code?: number) {\r\n super((code ? `${code}: ` : \"\") + message);\r\n\r\n this.name = \"ResponseError\";\r\n }\r\n}\r\n","export class InvalidDomainNameException extends Error {\r\n constructor(domainName: string) {\r\n super(`The provided domain name [${domainName}] is not valid`);\r\n\r\n this.name = \"InvalidDomainNameException\";\r\n }\r\n}\r\n","import APIClient from \"./api\";\r\nimport { Commands, Command } from \"./commands\";\r\nimport { InvalidDomainNameException } from \"./exceptions\";\r\nimport { DomainPriceAction } from \"./types\";\r\n\r\nexport interface INamecheapConfig {\r\n ApiUser: string;\r\n ApiKey: string;\r\n UserName: string;\r\n ClientIp: string;\r\n}\r\n\r\nexport interface IReponse {\r\n data: any;\r\n status: number;\r\n}\r\n\r\nexport interface ICheckDomainResponse {\r\n availabe: boolean;\r\n premium: boolean;\r\n}\r\n\r\nclass Namecheap {\r\n private readonly apiClient: APIClient;\r\n constructor(private readonly config: INamecheapConfig, sandbox?: boolean) {\r\n const baseURL = `https://api${\r\n sandbox ? \".sandbox\" : \"\"\r\n }.namecheap.com/xml.response`;\r\n this.apiClient = new APIClient(baseURL);\r\n }\r\n\r\n async call(\r\n command: Command,\r\n payload: Record<string, string>\r\n ): Promise<IReponse> {\r\n const params = {\r\n ...payload,\r\n ...this.config,\r\n command,\r\n };\r\n\r\n const url = \"?\" + new URLSearchParams(params).toString();\r\n\r\n const { data, status } = await this.apiClient.get(url);\r\n\r\n return { data, status };\r\n }\r\n\r\n async checkDomain(domainName: string): Promise<ICheckDomainResponse> {\r\n const { data } = await this.call(Commands.DOMAINS_CHECK, {\r\n DomainList: domainName,\r\n });\r\n\r\n const isAvailabe: string = data[0].DomainCheckResult[0].$.Available;\r\n const isPremium: string = data[0].DomainCheckResult[0].$.IsPremiumName;\r\n\r\n const response: ICheckDomainResponse = {\r\n availabe: isAvailabe === \"true\",\r\n premium: isPremium === \"true\",\r\n };\r\n\r\n return response;\r\n }\r\n\r\n async getDomainPrice(\r\n domainName: string,\r\n action: DomainPriceAction\r\n ): Promise<IReponse> {\r\n const [_, tld] = domainName.split(\".\");\r\n if (!tld) {\r\n throw new InvalidDomainNameException(domainName);\r\n }\r\n\r\n const { data, status } = await this.call(Commands.USERS_GETPRICING, {\r\n ProductType: \"DOMAIN\",\r\n ProductCategory: \"DOMAINS\",\r\n ActionName: action,\r\n ProductName: tld,\r\n });\r\n\r\n const pricing =\r\n data[0].UserGetPricingResult[0]?.ProductType?.[0]?.ProductCategory?.[0]?.Product?.[0]?.Price?.map(\r\n (price: any) => ({ ...price.$ })\r\n );\r\n\r\n return { data: pricing, status };\r\n }\r\n}\r\n\r\nexport default Namecheap;\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAO,IAAK,WAAL,kBAAKA,cAAL;AAEL,EAAAA,UAAA,qBAAkB;AAClB,EAAAA,UAAA,yBAAsB;AACtB,EAAAA,UAAA,oBAAiB;AACjB,EAAAA,UAAA,wBAAqB;AACrB,EAAAA,UAAA,yBAAsB;AACtB,EAAAA,UAAA,mBAAgB;AAChB,EAAAA,UAAA,wBAAqB;AACrB,EAAAA,UAAA,mBAAgB;AAChB,EAAAA,UAAA,8BAA2B;AAC3B,EAAAA,UAAA,8BAA2B;AAC3B,EAAAA,UAAA,qBAAkB;AAGlB,EAAAA,UAAA,4BAAyB;AACzB,EAAAA,UAAA,2BAAwB;AACxB,EAAAA,UAAA,yBAAsB;AACtB,EAAAA,UAAA,0BAAuB;AACvB,EAAAA,UAAA,oCAAiC;AACjC,EAAAA,UAAA,oCAAiC;AACjC,EAAAA,UAAA,0BAAuB;AAGvB,EAAAA,UAAA,uBAAoB;AACpB,EAAAA,UAAA,uBAAoB;AACpB,EAAAA,UAAA,wBAAqB;AACrB,EAAAA,UAAA,uBAAoB;AAGpB,EAAAA,UAAA,6BAA0B;AAC1B,EAAAA,UAAA,gCAA6B;AAC7B,EAAAA,UAAA,mCAAgC;AAChC,EAAAA,UAAA,8BAA2B;AAG3B,EAAAA,UAAA,gBAAa;AACb,EAAAA,UAAA,iBAAc;AACd,EAAAA,UAAA,kBAAe;AACf,EAAAA,UAAA,8BAA2B;AAC3B,EAAAA,UAAA,kBAAe;AACf,EAAAA,UAAA,6BAA0B;AAC1B,EAAAA,UAAA,iBAAc;A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vD,YAAM,EAAE,MAAM,OAAO,IAAI,MAAM,KAAK,UAAU,IAAI,GAAG;AAErD,aAAO,EAAE,MAAM,OAAO;AAAA,IACxB;AAAA;AAAA,EAEM,YAAY,YAAmD;AAAA;AACnE,YAAM,EAAE,KAAK,IAAI,MAAM,KAAK,oDAA6B;AAAA,QACvD,YAAY;AAAA,MACd,CAAC;AAED,YAAM,aAAqB,KAAK,CAAC,EAAE,kBAAkB,CAAC,EAAE,EAAE;AAC1D,YAAM,YAAoB,KAAK,CAAC,EAAE,kBAAkB,CAAC,EAAE,EAAE;AAEzD,YAAM,WAAiC;AAAA,QACrC,UAAU,eAAe;AAAA,QACzB,SAAS,cAAc;AAAA,MACzB;AAEA,aAAO;AAAA,IACT;AAAA;AAAA,EAEM,eACJ,YACA,QACmB;AAAA;AAnEvB;AAoEI,YAAM,CAAC,GAAG,GAAG,IAAI,WAAW,MAAM,GAAG;AACrC,UAAI,CAAC,KAAK;AACR,cAAM,IAAI,2BAA2B,UAAU;AAAA,MACjD;AAEA,YAAM,EAAE,MAAM,OAAO,IAAI,MAAM,KAAK,0DAAgC;AAAA,QAClE,aAAa;AAAA,QACb,iBAAiB;AAAA,QACjB,YAAY;AAAA,QACZ,aAAa;AAAA,MACf,CAAC;AAED,YAAM,WACJ,oDAAK,CAAC,EAAE,qBAAqB,CAAC,MAA9B,mBAAiC,gBAAjC,mBAA+C,OAA/C,mBAAmD,oBAAnD,mBAAqE,OAArE,mBAAyE,YAAzE,mBAAmF,OAAnF,mBAAuF,UAAvF,mBAA8F;AAAA,QAC5F,CAAC,UAAgB,mBAAK,MAAM;AAAA;AAGhC,aAAO,EAAE,MAAM,SAAS,OAAO;AAAA,IACjC;AAAA;AACF;AAEA,IAAO,oBAAQ;","names":["Commands","DomainPriceActions","axios"]}
|
package/dist/index.mjs
CHANGED
|
@@ -38,6 +38,79 @@ var __async = (__this, __arguments, generator) => {
|
|
|
38
38
|
});
|
|
39
39
|
};
|
|
40
40
|
|
|
41
|
+
// src/commands.ts
|
|
42
|
+
var Commands = /* @__PURE__ */ ((Commands2) => {
|
|
43
|
+
Commands2["DOMAINS_GETLIST"] = "namecheap.domains.getList";
|
|
44
|
+
Commands2["DOMAINS_GETCONTACTS"] = "namecheap.domains.getContacts";
|
|
45
|
+
Commands2["DOMAINS_CREATE"] = "namecheap.domains.create";
|
|
46
|
+
Commands2["DOMAINS_GETTLDLIST"] = "namecheap.domains.getTldList";
|
|
47
|
+
Commands2["DOMAINS_SETCONTACTS"] = "namecheap.domains.setContacts";
|
|
48
|
+
Commands2["DOMAINS_CHECK"] = "namecheap.domains.check";
|
|
49
|
+
Commands2["DOMAINS_REACTIVATE"] = "namecheap.domains.reactivate";
|
|
50
|
+
Commands2["DOMAINS_RENEW"] = "namecheap.domains.renew";
|
|
51
|
+
Commands2["DOMAINS_GETREGISTRARLOCK"] = "namecheap.domains.getRegistrarLock";
|
|
52
|
+
Commands2["DOMAINS_SETREGISTRARLOCK"] = "namecheap.domains.setRegistrarLock";
|
|
53
|
+
Commands2["DOMAINS_GETINFO"] = "namecheap.domains.getInfo";
|
|
54
|
+
Commands2["DOMAINS_DNS_SETDEFAULT"] = "namecheap.domains.dns.setDefault";
|
|
55
|
+
Commands2["DOMAINS_DNS_SETCUSTOM"] = "namecheap.domains.dns.setCustom";
|
|
56
|
+
Commands2["DOMAINS_DNS_GETLIST"] = "namecheap.domains.dns.getList";
|
|
57
|
+
Commands2["DOMAINS_DNS_GETHOSTS"] = "namecheap.domains.dns.getHosts";
|
|
58
|
+
Commands2["DOMAINS_DNS_GETEMAILFORWARDING"] = "namecheap.domains.dns.getEmailForwarding";
|
|
59
|
+
Commands2["DOMAINS_DNS_SETEMAILFORWARDING"] = "namecheap.domains.dns.setEmailForwarding";
|
|
60
|
+
Commands2["DOMAINS_DNS_SETHOSTS"] = "namecheap.domains.dns.setHosts";
|
|
61
|
+
Commands2["DOMAINS_NS_CREATE"] = "namecheap.domains.ns.create";
|
|
62
|
+
Commands2["DOMAINS_NS_DELETE"] = "namecheap.domains.ns.delete";
|
|
63
|
+
Commands2["DOMAINS_NS_GETINFO"] = "namecheap.domains.ns.getInfo";
|
|
64
|
+
Commands2["DOMAINS_NS_UPDATE"] = "namecheap.domains.ns.update";
|
|
65
|
+
Commands2["DOMAINS_TRANSFER_CREATE"] = "namecheap.domains.transfer.create";
|
|
66
|
+
Commands2["DOMAINS_TRANSFER_GETSTATUS"] = "namecheap.domains.transfer.getStatus";
|
|
67
|
+
Commands2["DOMAINS_TRANSFER_UPDATESTATUS"] = "namecheap.domains.transfer.updateStatus";
|
|
68
|
+
Commands2["DOMAINS_TRANSFER_GETLIST"] = "namecheap.domains.transfer.getList";
|
|
69
|
+
Commands2["SSL_CREATE"] = "namecheap.ssl.create";
|
|
70
|
+
Commands2["SSL_GETLIST"] = "namecheap.ssl.getList";
|
|
71
|
+
Commands2["SSL_PARSECSR"] = "namecheap.ssl.parseCSR";
|
|
72
|
+
Commands2["SSL_GETAPPROVEREMAILLIST"] = "namecheap.ssl.getApproverEmailList";
|
|
73
|
+
Commands2["SSL_ACTIVATE"] = "namecheap.ssl.activate";
|
|
74
|
+
Commands2["SSL_RESENDAPPROVEREMAIL"] = "namecheap.ssl.resendApproverEmail";
|
|
75
|
+
Commands2["SSL_GETINFO"] = "namecheap.ssl.getInfo";
|
|
76
|
+
Commands2["SSL_RENEW"] = "namecheap.ssl.renew";
|
|
77
|
+
Commands2["SSL_REISSUE"] = "namecheap.ssl.reissue";
|
|
78
|
+
Commands2["SSL_RESENDFULFILLMENTEMAIL"] = "namecheap.ssl.resendfulfillmentemail";
|
|
79
|
+
Commands2["SSL_PURCHASEMORESANS"] = "namecheap.ssl.purchasemoresans";
|
|
80
|
+
Commands2["SSL_REVOKECERTIFICATE"] = "namecheap.ssl.revokecertificate";
|
|
81
|
+
Commands2["SSL_EDITDCVMETHOD"] = "namecheap.ssl.editDCVMethod";
|
|
82
|
+
Commands2["USERS_GETPRICING"] = "namecheap.users.getPricing";
|
|
83
|
+
Commands2["USERS_GETBALANCES"] = "namecheap.users.getBalances";
|
|
84
|
+
Commands2["USERS_CHANGEPASSWORD"] = "namecheap.users.changePassword";
|
|
85
|
+
Commands2["USERS_UPDATE"] = "namecheap.users.update";
|
|
86
|
+
Commands2["USERS_CREATEADDFUNDSREQUEST"] = "namecheap.users.createaddfundsrequest";
|
|
87
|
+
Commands2["USERS_GETADDFUNDSSTATUS"] = "namecheap.users.getAddFundsStatus";
|
|
88
|
+
Commands2["USERS_CREATE"] = "namecheap.users.create";
|
|
89
|
+
Commands2["USERS_LOGIN"] = "namecheap.users.login";
|
|
90
|
+
Commands2["USERS_RESETPASSWORD"] = "namecheap.users.resetPassword";
|
|
91
|
+
Commands2["USERS_ADDRESS_CREATE"] = "namecheap.users.address.create";
|
|
92
|
+
Commands2["USERS_ADDRESS_DELETE"] = "namecheap.users.address.delete";
|
|
93
|
+
Commands2["USERS_ADDRESS_GETINFO"] = "namecheap.users.address.getInfo";
|
|
94
|
+
Commands2["USERS_ADDRESS_GETLIST"] = "namecheap.users.address.getList";
|
|
95
|
+
Commands2["USERS_ADDRESS_SETDEFAULT"] = "namecheap.users.address.setDefault";
|
|
96
|
+
Commands2["USERS_ADDRESS_UPDATE"] = "namecheap.users.address.update";
|
|
97
|
+
Commands2["WHOISGUARD_CHANGEEMAILADDRESS"] = "Namecheap.Whoisguard.changeemailaddress";
|
|
98
|
+
Commands2["WHOISGUARD_ENABLE"] = "Namecheap.Whoisguard.enable";
|
|
99
|
+
Commands2["WHOISGUARD_DISABLE"] = "Namecheap.Whoisguard.disable";
|
|
100
|
+
Commands2["WHOISGUARD_GETLIST"] = "Namecheap.Whoisguard.getList";
|
|
101
|
+
Commands2["WHOISGUARD_RENEW"] = "Namecheap.Whoisguard.renew";
|
|
102
|
+
return Commands2;
|
|
103
|
+
})(Commands || {});
|
|
104
|
+
|
|
105
|
+
// src/types.ts
|
|
106
|
+
var DomainPriceActions = /* @__PURE__ */ ((DomainPriceActions2) => {
|
|
107
|
+
DomainPriceActions2["REGISTER"] = "REGISTER";
|
|
108
|
+
DomainPriceActions2["RENEW"] = "RENEW";
|
|
109
|
+
DomainPriceActions2["REACTIVATE"] = "REACTIVATE";
|
|
110
|
+
DomainPriceActions2["TRANSFER"] = "TRANSFER";
|
|
111
|
+
return DomainPriceActions2;
|
|
112
|
+
})(DomainPriceActions || {});
|
|
113
|
+
|
|
41
114
|
// src/api/api-client.ts
|
|
42
115
|
import axios from "axios";
|
|
43
116
|
import { parseStringPromise } from "xml2js";
|
|
@@ -92,6 +165,14 @@ var APIClient = class {
|
|
|
92
165
|
};
|
|
93
166
|
var api_client_default = APIClient;
|
|
94
167
|
|
|
168
|
+
// src/exceptions/InvalidDomainNameException.ts
|
|
169
|
+
var InvalidDomainNameException = class extends Error {
|
|
170
|
+
constructor(domainName) {
|
|
171
|
+
super(`The provided domain name [${domainName}] is not valid`);
|
|
172
|
+
this.name = "InvalidDomainNameException";
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
|
|
95
176
|
// src/namecheap.ts
|
|
96
177
|
var Namecheap = class {
|
|
97
178
|
constructor(config, sandbox) {
|
|
@@ -101,7 +182,7 @@ var Namecheap = class {
|
|
|
101
182
|
}
|
|
102
183
|
call(command, payload) {
|
|
103
184
|
return __async(this, null, function* () {
|
|
104
|
-
const params = __spreadProps(__spreadValues(__spreadValues({}, this.config),
|
|
185
|
+
const params = __spreadProps(__spreadValues(__spreadValues({}, payload), this.config), {
|
|
105
186
|
command
|
|
106
187
|
});
|
|
107
188
|
const url = "?" + new URLSearchParams(params).toString();
|
|
@@ -109,9 +190,44 @@ var Namecheap = class {
|
|
|
109
190
|
return { data, status };
|
|
110
191
|
});
|
|
111
192
|
}
|
|
193
|
+
checkDomain(domainName) {
|
|
194
|
+
return __async(this, null, function* () {
|
|
195
|
+
const { data } = yield this.call("namecheap.domains.check" /* DOMAINS_CHECK */, {
|
|
196
|
+
DomainList: domainName
|
|
197
|
+
});
|
|
198
|
+
const isAvailabe = data[0].DomainCheckResult[0].$.Available;
|
|
199
|
+
const isPremium = data[0].DomainCheckResult[0].$.IsPremiumName;
|
|
200
|
+
const response = {
|
|
201
|
+
availabe: isAvailabe === "true",
|
|
202
|
+
premium: isPremium === "true"
|
|
203
|
+
};
|
|
204
|
+
return response;
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
getDomainPrice(domainName, action) {
|
|
208
|
+
return __async(this, null, function* () {
|
|
209
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
210
|
+
const [_, tld] = domainName.split(".");
|
|
211
|
+
if (!tld) {
|
|
212
|
+
throw new InvalidDomainNameException(domainName);
|
|
213
|
+
}
|
|
214
|
+
const { data, status } = yield this.call("namecheap.users.getPricing" /* USERS_GETPRICING */, {
|
|
215
|
+
ProductType: "DOMAIN",
|
|
216
|
+
ProductCategory: "DOMAINS",
|
|
217
|
+
ActionName: action,
|
|
218
|
+
ProductName: tld
|
|
219
|
+
});
|
|
220
|
+
const pricing = (_h = (_g = (_f = (_e = (_d = (_c = (_b = (_a = data[0].UserGetPricingResult[0]) == null ? void 0 : _a.ProductType) == null ? void 0 : _b[0]) == null ? void 0 : _c.ProductCategory) == null ? void 0 : _d[0]) == null ? void 0 : _e.Product) == null ? void 0 : _f[0]) == null ? void 0 : _g.Price) == null ? void 0 : _h.map(
|
|
221
|
+
(price) => __spreadValues({}, price.$)
|
|
222
|
+
);
|
|
223
|
+
return { data: pricing, status };
|
|
224
|
+
});
|
|
225
|
+
}
|
|
112
226
|
};
|
|
113
227
|
var namecheap_default = Namecheap;
|
|
114
228
|
export {
|
|
229
|
+
Commands,
|
|
230
|
+
DomainPriceActions,
|
|
115
231
|
namecheap_default as default
|
|
116
232
|
};
|
|
117
233
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/api/api-client.ts","../src/api/errors.ts","../src/namecheap.ts"],"sourcesContent":["import axios, { AxiosInstance, AxiosResponse } from \"axios\";\r\nimport { parseStringPromise } from \"xml2js\";\r\nimport { ResponseError, XMLParsingError } from \"./errors\";\r\n\r\nclass APIClient {\r\n private readonly _client: AxiosInstance;\r\n constructor(baseURL: string) {\r\n this._client = axios.create({ baseURL });\r\n this._client.interceptors.response.use(this.onResponse);\r\n }\r\n\r\n async get(url: string) {\r\n return await this._client.get(url);\r\n }\r\n\r\n private async onResponse(response: AxiosResponse): Promise<AxiosResponse> {\r\n try {\r\n const result = await parseStringPromise(response.data);\r\n\r\n if (result.ApiResponse.$.Status === \"ERROR\") {\r\n const responseErrors = result.ApiResponse.Errors;\r\n const code = responseErrors[0].Error[0].$.Number;\r\n const message = responseErrors[0].Error[0]._;\r\n\r\n throw new ResponseError(message, code);\r\n }\r\n\r\n response.data = result.ApiResponse.CommandResponse;\r\n } catch (err) {\r\n response.status = 400;\r\n if (err instanceof ResponseError) {\r\n throw err;\r\n }\r\n\r\n throw new XMLParsingError();\r\n }\r\n\r\n return response;\r\n }\r\n}\r\n\r\nexport default APIClient;\r\n","export class XMLParsingError extends Error {\r\n constructor() {\r\n super(\"Invalid XML response\");\r\n\r\n this.name = \"XMLParsingError\";\r\n }\r\n}\r\n\r\nexport class ResponseError extends Error {\r\n constructor(message: string, readonly code?: number) {\r\n super((code ? `${code}: ` : \"\") + message);\r\n\r\n this.name = \"ResponseError\";\r\n }\r\n}\r\n","import APIClient from \"./api\";\r\nimport { ICommand } from \"./commands\";\r\n\r\nexport interface INamecheapConfig {\r\n ApiUser: string;\r\n ApiKey: string;\r\n UserName: string;\r\n ClientIp: string;\r\n}\r\n\r\nexport interface ICallReponse {\r\n data: any;\r\n status: number;\r\n}\r\n\r\nclass Namecheap {\r\n private readonly apiClient: APIClient;\r\n constructor(private readonly config: INamecheapConfig, sandbox?: boolean) {\r\n const baseURL = `https://api${\r\n sandbox ? \".sandbox\" : \"\"\r\n }.namecheap.com/xml.response`;\r\n this.apiClient = new APIClient(baseURL);\r\n }\r\n\r\n async call(\r\n command: ICommand,\r\n payload: Record<string, string>\r\n ): Promise<ICallReponse> {\r\n const params = {\r\n ...this.config,\r\n ...payload,\r\n command,\r\n };\r\n\r\n const url = \"?\" + new URLSearchParams(params).toString();\r\n\r\n const { data, status } = await this.apiClient.get(url);\r\n\r\n return { data, status };\r\n }\r\n}\r\n\r\nexport default Namecheap;\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,WAA6C;AACpD,SAAS,0BAA0B;;;ACD5B,IAAM,kBAAN,cAA8B,MAAM;AAAA,EACzC,cAAc;AACZ,UAAM,sBAAsB;AAE5B,SAAK,OAAO;AAAA,EACd;AACF;AAEO,IAAM,gBAAN,cAA4B,MAAM;AAAA,EACvC,YAAY,SAA0B,MAAe;AACnD,WAAO,OAAO,GAAG,IAAI,OAAO,MAAM,OAAO;AADL;AAGpC,SAAK,OAAO;AAAA,EACd;AACF;;;ADVA,IAAM,YAAN,MAAgB;AAAA,EAEd,YAAY,SAAiB;AAC3B,SAAK,UAAU,MAAM,OAAO,EAAE,QAAQ,CAAC;AACvC,SAAK,QAAQ,aAAa,SAAS,IAAI,KAAK,UAAU;AAAA,EACxD;AAAA,EAEM,IAAI,KAAa;AAAA;AACrB,aAAO,MAAM,KAAK,QAAQ,IAAI,GAAG;AAAA,IACnC;AAAA;AAAA,EAEc,WAAW,UAAiD;AAAA;AACxE,UAAI;AACF,cAAM,SAAS,MAAM,mBAAmB,SAAS,IAAI;AAErD,YAAI,OAAO,YAAY,EAAE,WAAW,SAAS;AAC3C,gBAAM,iBAAiB,OAAO,YAAY;AAC1C,gBAAM,OAAO,eAAe,CAAC,EAAE,MAAM,CAAC,EAAE,EAAE;AAC1C,gBAAM,UAAU,eAAe,CAAC,EAAE,MAAM,CAAC,EAAE;AAE3C,gBAAM,IAAI,cAAc,SAAS,IAAI;AAAA,QACvC;AAEA,iBAAS,OAAO,OAAO,YAAY;AAAA,MACrC,SAAS,KAAK;AACZ,iBAAS,SAAS;AAClB,YAAI,eAAe,eAAe;AAChC,gBAAM;AAAA,QACR;AAEA,cAAM,IAAI,gBAAgB;AAAA,MAC5B;AAEA,aAAO;AAAA,IACT;AAAA;AACF;AAEA,IAAO,qBAAQ;;;AE1Bf,IAAM,YAAN,MAAgB;AAAA,EAEd,YAA6B,QAA0B,SAAmB;AAA7C;AAC3B,UAAM,UAAU,cACd,UAAU,aAAa,EACzB;AACA,SAAK,YAAY,IAAI,mBAAU,OAAO;AAAA,EACxC;AAAA,EAEM,KACJ,SACA,SACuB;AAAA;AACvB,YAAM,SAAS,gDACV,KAAK,SACL,UAFU;AAAA,QAGb;AAAA,MACF;AAEA,YAAM,MAAM,MAAM,IAAI,gBAAgB,MAAM,EAAE,SAAS;AAEvD,YAAM,EAAE,MAAM,OAAO,IAAI,MAAM,KAAK,UAAU,IAAI,GAAG;AAErD,aAAO,EAAE,MAAM,OAAO;AAAA,IACxB;AAAA;AACF;AAEA,IAAO,oBAAQ;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/commands.ts","../src/types.ts","../src/api/api-client.ts","../src/api/errors.ts","../src/exceptions/InvalidDomainNameException.ts","../src/namecheap.ts"],"sourcesContent":["export enum Commands {\r\n // domains\r\n DOMAINS_GETLIST = \"namecheap.domains.getList\",\r\n DOMAINS_GETCONTACTS = \"namecheap.domains.getContacts\",\r\n DOMAINS_CREATE = \"namecheap.domains.create\",\r\n DOMAINS_GETTLDLIST = \"namecheap.domains.getTldList\",\r\n DOMAINS_SETCONTACTS = \"namecheap.domains.setContacts\",\r\n DOMAINS_CHECK = \"namecheap.domains.check\",\r\n DOMAINS_REACTIVATE = \"namecheap.domains.reactivate\",\r\n DOMAINS_RENEW = \"namecheap.domains.renew\",\r\n DOMAINS_GETREGISTRARLOCK = \"namecheap.domains.getRegistrarLock\",\r\n DOMAINS_SETREGISTRARLOCK = \"namecheap.domains.setRegistrarLock\",\r\n DOMAINS_GETINFO = \"namecheap.domains.getInfo\",\r\n\r\n // domains.dns\r\n DOMAINS_DNS_SETDEFAULT = \"namecheap.domains.dns.setDefault\",\r\n DOMAINS_DNS_SETCUSTOM = \"namecheap.domains.dns.setCustom\",\r\n DOMAINS_DNS_GETLIST = \"namecheap.domains.dns.getList\",\r\n DOMAINS_DNS_GETHOSTS = \"namecheap.domains.dns.getHosts\",\r\n DOMAINS_DNS_GETEMAILFORWARDING = \"namecheap.domains.dns.getEmailForwarding\",\r\n DOMAINS_DNS_SETEMAILFORWARDING = \"namecheap.domains.dns.setEmailForwarding\",\r\n DOMAINS_DNS_SETHOSTS = \"namecheap.domains.dns.setHosts\",\r\n\r\n // domains.ns\r\n DOMAINS_NS_CREATE = \"namecheap.domains.ns.create\",\r\n DOMAINS_NS_DELETE = \"namecheap.domains.ns.delete\",\r\n DOMAINS_NS_GETINFO = \"namecheap.domains.ns.getInfo\",\r\n DOMAINS_NS_UPDATE = \"namecheap.domains.ns.update\",\r\n\r\n // domains.transfer\r\n DOMAINS_TRANSFER_CREATE = \"namecheap.domains.transfer.create\",\r\n DOMAINS_TRANSFER_GETSTATUS = \"namecheap.domains.transfer.getStatus\",\r\n DOMAINS_TRANSFER_UPDATESTATUS = \"namecheap.domains.transfer.updateStatus\",\r\n DOMAINS_TRANSFER_GETLIST = \"namecheap.domains.transfer.getList\",\r\n\r\n // ssl\r\n SSL_CREATE = \"namecheap.ssl.create\",\r\n SSL_GETLIST = \"namecheap.ssl.getList\",\r\n SSL_PARSECSR = \"namecheap.ssl.parseCSR\",\r\n SSL_GETAPPROVEREMAILLIST = \"namecheap.ssl.getApproverEmailList\",\r\n SSL_ACTIVATE = \"namecheap.ssl.activate\",\r\n SSL_RESENDAPPROVEREMAIL = \"namecheap.ssl.resendApproverEmail\",\r\n SSL_GETINFO = \"namecheap.ssl.getInfo\",\r\n SSL_RENEW = \"namecheap.ssl.renew\",\r\n SSL_REISSUE = \"namecheap.ssl.reissue\",\r\n SSL_RESENDFULFILLMENTEMAIL = \"namecheap.ssl.resendfulfillmentemail\",\r\n SSL_PURCHASEMORESANS = \"namecheap.ssl.purchasemoresans\",\r\n SSL_REVOKECERTIFICATE = \"namecheap.ssl.revokecertificate\",\r\n SSL_EDITDCVMETHOD = \"namecheap.ssl.editDCVMethod\",\r\n\r\n // users\r\n USERS_GETPRICING = \"namecheap.users.getPricing\",\r\n USERS_GETBALANCES = \"namecheap.users.getBalances\",\r\n USERS_CHANGEPASSWORD = \"namecheap.users.changePassword\",\r\n USERS_UPDATE = \"namecheap.users.update\",\r\n USERS_CREATEADDFUNDSREQUEST = \"namecheap.users.createaddfundsrequest\",\r\n USERS_GETADDFUNDSSTATUS = \"namecheap.users.getAddFundsStatus\",\r\n USERS_CREATE = \"namecheap.users.create\",\r\n USERS_LOGIN = \"namecheap.users.login\",\r\n USERS_RESETPASSWORD = \"namecheap.users.resetPassword\",\r\n\r\n // users.address\r\n USERS_ADDRESS_CREATE = \"namecheap.users.address.create\",\r\n USERS_ADDRESS_DELETE = \"namecheap.users.address.delete\",\r\n USERS_ADDRESS_GETINFO = \"namecheap.users.address.getInfo\",\r\n USERS_ADDRESS_GETLIST = \"namecheap.users.address.getList\",\r\n USERS_ADDRESS_SETDEFAULT = \"namecheap.users.address.setDefault\",\r\n USERS_ADDRESS_UPDATE = \"namecheap.users.address.update\",\r\n\r\n // domainprivacy\r\n WHOISGUARD_CHANGEEMAILADDRESS = \"Namecheap.Whoisguard.changeemailaddress\",\r\n WHOISGUARD_ENABLE = \"Namecheap.Whoisguard.enable\",\r\n WHOISGUARD_DISABLE = \"Namecheap.Whoisguard.disable\",\r\n WHOISGUARD_GETLIST = \"Namecheap.Whoisguard.getList\",\r\n WHOISGUARD_RENEW = \"Namecheap.Whoisguard.renew\",\r\n}\r\n\r\nexport type Command = `${Commands}`;\r\n","export enum DomainPriceActions {\r\n REGISTER = \"REGISTER\",\r\n RENEW = \"RENEW\",\r\n REACTIVATE = \"REACTIVATE\",\r\n TRANSFER = \"TRANSFER\",\r\n}\r\n\r\nexport type DomainPriceAction = `${DomainPriceActions}`;\r\n","import axios, { AxiosInstance, AxiosResponse } from \"axios\";\r\nimport { parseStringPromise } from \"xml2js\";\r\nimport { ResponseError, XMLParsingError } from \"./errors\";\r\n\r\nclass APIClient {\r\n private readonly _client: AxiosInstance;\r\n constructor(baseURL: string) {\r\n this._client = axios.create({ baseURL });\r\n this._client.interceptors.response.use(this.onResponse);\r\n }\r\n\r\n async get(url: string) {\r\n return await this._client.get(url);\r\n }\r\n\r\n private async onResponse(response: AxiosResponse): Promise<AxiosResponse> {\r\n try {\r\n const result = await parseStringPromise(response.data);\r\n\r\n if (result.ApiResponse.$.Status === \"ERROR\") {\r\n const responseErrors = result.ApiResponse.Errors;\r\n const code = responseErrors[0].Error[0].$.Number;\r\n const message = responseErrors[0].Error[0]._;\r\n\r\n throw new ResponseError(message, code);\r\n }\r\n\r\n response.data = result.ApiResponse.CommandResponse;\r\n } catch (err) {\r\n response.status = 400;\r\n if (err instanceof ResponseError) {\r\n throw err;\r\n }\r\n\r\n throw new XMLParsingError();\r\n }\r\n\r\n return response;\r\n }\r\n}\r\n\r\nexport default APIClient;\r\n","export class XMLParsingError extends Error {\r\n constructor() {\r\n super(\"Invalid XML response\");\r\n\r\n this.name = \"XMLParsingError\";\r\n }\r\n}\r\n\r\nexport class ResponseError extends Error {\r\n constructor(message: string, readonly code?: number) {\r\n super((code ? `${code}: ` : \"\") + message);\r\n\r\n this.name = \"ResponseError\";\r\n }\r\n}\r\n","export class InvalidDomainNameException extends Error {\r\n constructor(domainName: string) {\r\n super(`The provided domain name [${domainName}] is not valid`);\r\n\r\n this.name = \"InvalidDomainNameException\";\r\n }\r\n}\r\n","import APIClient from \"./api\";\r\nimport { Commands, Command } from \"./commands\";\r\nimport { InvalidDomainNameException } from \"./exceptions\";\r\nimport { DomainPriceAction } from \"./types\";\r\n\r\nexport interface INamecheapConfig {\r\n ApiUser: string;\r\n ApiKey: string;\r\n UserName: string;\r\n ClientIp: string;\r\n}\r\n\r\nexport interface IReponse {\r\n data: any;\r\n status: number;\r\n}\r\n\r\nexport interface ICheckDomainResponse {\r\n availabe: boolean;\r\n premium: boolean;\r\n}\r\n\r\nclass Namecheap {\r\n private readonly apiClient: APIClient;\r\n constructor(private readonly config: INamecheapConfig, sandbox?: boolean) {\r\n const baseURL = `https://api${\r\n sandbox ? \".sandbox\" : \"\"\r\n }.namecheap.com/xml.response`;\r\n this.apiClient = new APIClient(baseURL);\r\n }\r\n\r\n async call(\r\n command: Command,\r\n payload: Record<string, string>\r\n ): Promise<IReponse> {\r\n const params = {\r\n ...payload,\r\n ...this.config,\r\n command,\r\n };\r\n\r\n const url = \"?\" + new URLSearchParams(params).toString();\r\n\r\n const { data, status } = await this.apiClient.get(url);\r\n\r\n return { data, status };\r\n }\r\n\r\n async checkDomain(domainName: string): Promise<ICheckDomainResponse> {\r\n const { data } = await this.call(Commands.DOMAINS_CHECK, {\r\n DomainList: domainName,\r\n });\r\n\r\n const isAvailabe: string = data[0].DomainCheckResult[0].$.Available;\r\n const isPremium: string = data[0].DomainCheckResult[0].$.IsPremiumName;\r\n\r\n const response: ICheckDomainResponse = {\r\n availabe: isAvailabe === \"true\",\r\n premium: isPremium === \"true\",\r\n };\r\n\r\n return response;\r\n }\r\n\r\n async getDomainPrice(\r\n domainName: string,\r\n action: DomainPriceAction\r\n ): Promise<IReponse> {\r\n const [_, tld] = domainName.split(\".\");\r\n if (!tld) {\r\n throw new InvalidDomainNameException(domainName);\r\n }\r\n\r\n const { data, status } = await this.call(Commands.USERS_GETPRICING, {\r\n ProductType: \"DOMAIN\",\r\n ProductCategory: \"DOMAINS\",\r\n ActionName: action,\r\n ProductName: tld,\r\n });\r\n\r\n const pricing =\r\n data[0].UserGetPricingResult[0]?.ProductType?.[0]?.ProductCategory?.[0]?.Product?.[0]?.Price?.map(\r\n (price: any) => ({ ...price.$ })\r\n );\r\n\r\n return { data: pricing, status };\r\n }\r\n}\r\n\r\nexport default Namecheap;\r\n"],"mappings":";;;;;;;;;;;;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,KAAK,CAAC,EAAE,kBAAkB,CAAC,EAAE,EAAE;AAC1D,YAAM,YAAoB,KAAK,CAAC,EAAE,kBAAkB,CAAC,EAAE,EAAE;AAEzD,YAAM,WAAiC;AAAA,QACrC,UAAU,eAAe;AAAA,QACzB,SAAS,cAAc;AAAA,MACzB;AAEA,aAAO;AAAA,IACT;AAAA;AAAA,EAEM,eACJ,YACA,QACmB;AAAA;AAnEvB;AAoEI,YAAM,CAAC,GAAG,GAAG,IAAI,WAAW,MAAM,GAAG;AACrC,UAAI,CAAC,KAAK;AACR,cAAM,IAAI,2BAA2B,UAAU;AAAA,MACjD;AAEA,YAAM,EAAE,MAAM,OAAO,IAAI,MAAM,KAAK,0DAAgC;AAAA,QAClE,aAAa;AAAA,QACb,iBAAiB;AAAA,QACjB,YAAY;AAAA,QACZ,aAAa;AAAA,MACf,CAAC;AAED,YAAM,WACJ,oDAAK,CAAC,EAAE,qBAAqB,CAAC,MAA9B,mBAAiC,gBAAjC,mBAA+C,OAA/C,mBAAmD,oBAAnD,mBAAqE,OAArE,mBAAyE,YAAzE,mBAAmF,OAAnF,mBAAuF,UAAvF,mBAA8F;AAAA,QAC5F,CAAC,UAAgB,mBAAK,MAAM;AAAA;AAGhC,aAAO,EAAE,MAAM,SAAS,OAAO;AAAA,IACjC;AAAA;AACF;AAEA,IAAO,oBAAQ;","names":["Commands","DomainPriceActions"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "namecheap-ts",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "A simple wrapper for namecheap API",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
"scripts": {
|
|
12
12
|
"start": "tsc --build && node dist/index.js",
|
|
13
13
|
"build": "tsup",
|
|
14
|
+
"release": "rm -rf dist && tsup && npm publish",
|
|
14
15
|
"test": "jest"
|
|
15
16
|
},
|
|
16
17
|
"keywords": [
|