namecheap-ts 1.0.2 → 1.0.4
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 +101 -9
- package/dist/index.d.mts +116 -12
- package/dist/index.d.ts +125 -2
- package/dist/index.js +358 -21
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +214 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -2
- package/dist/api/api-client.d.ts +0 -8
- package/dist/api/api-client.js +0 -51
- package/dist/api/errors.d.ts +0 -7
- package/dist/api/errors.js +0 -18
- package/dist/api/index.d.ts +0 -1
- package/dist/api/index.js +0 -8
- package/dist/commands.d.ts +0 -62
- package/dist/commands.js +0 -73
- package/dist/exceptions/InvalidDomainNameException.d.ts +0 -3
- package/dist/exceptions/InvalidDomainNameException.js +0 -10
- package/dist/exceptions/InvalidTLDException.d.ts +0 -3
- package/dist/exceptions/InvalidTLDException.js +0 -10
- package/dist/exceptions/index.d.ts +0 -1
- package/dist/exceptions/index.js +0 -17
- package/dist/namecheap.d.ts +0 -25
- package/dist/namecheap.js +0 -64
- package/dist/types.d.ts +0 -7
- package/dist/types.js +0 -10
package/dist/index.mjs
CHANGED
|
@@ -17,6 +17,18 @@ var __spreadValues = (a, b) => {
|
|
|
17
17
|
return a;
|
|
18
18
|
};
|
|
19
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
var __objRest = (source, exclude) => {
|
|
21
|
+
var target = {};
|
|
22
|
+
for (var prop in source)
|
|
23
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
+
target[prop] = source[prop];
|
|
25
|
+
if (source != null && __getOwnPropSymbols)
|
|
26
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
+
target[prop] = source[prop];
|
|
29
|
+
}
|
|
30
|
+
return target;
|
|
31
|
+
};
|
|
20
32
|
var __async = (__this, __arguments, generator) => {
|
|
21
33
|
return new Promise((resolve, reject) => {
|
|
22
34
|
var fulfilled = (value) => {
|
|
@@ -38,9 +50,81 @@ var __async = (__this, __arguments, generator) => {
|
|
|
38
50
|
});
|
|
39
51
|
};
|
|
40
52
|
|
|
53
|
+
// src/commands.ts
|
|
54
|
+
var Commands = /* @__PURE__ */ ((Commands2) => {
|
|
55
|
+
Commands2["DOMAINS_GETLIST"] = "namecheap.domains.getList";
|
|
56
|
+
Commands2["DOMAINS_GETCONTACTS"] = "namecheap.domains.getContacts";
|
|
57
|
+
Commands2["DOMAINS_CREATE"] = "namecheap.domains.create";
|
|
58
|
+
Commands2["DOMAINS_GETTLDLIST"] = "namecheap.domains.getTldList";
|
|
59
|
+
Commands2["DOMAINS_SETCONTACTS"] = "namecheap.domains.setContacts";
|
|
60
|
+
Commands2["DOMAINS_CHECK"] = "namecheap.domains.check";
|
|
61
|
+
Commands2["DOMAINS_REACTIVATE"] = "namecheap.domains.reactivate";
|
|
62
|
+
Commands2["DOMAINS_RENEW"] = "namecheap.domains.renew";
|
|
63
|
+
Commands2["DOMAINS_GETREGISTRARLOCK"] = "namecheap.domains.getRegistrarLock";
|
|
64
|
+
Commands2["DOMAINS_SETREGISTRARLOCK"] = "namecheap.domains.setRegistrarLock";
|
|
65
|
+
Commands2["DOMAINS_GETINFO"] = "namecheap.domains.getInfo";
|
|
66
|
+
Commands2["DOMAINS_DNS_SETDEFAULT"] = "namecheap.domains.dns.setDefault";
|
|
67
|
+
Commands2["DOMAINS_DNS_SETCUSTOM"] = "namecheap.domains.dns.setCustom";
|
|
68
|
+
Commands2["DOMAINS_DNS_GETLIST"] = "namecheap.domains.dns.getList";
|
|
69
|
+
Commands2["DOMAINS_DNS_GETHOSTS"] = "namecheap.domains.dns.getHosts";
|
|
70
|
+
Commands2["DOMAINS_DNS_GETEMAILFORWARDING"] = "namecheap.domains.dns.getEmailForwarding";
|
|
71
|
+
Commands2["DOMAINS_DNS_SETEMAILFORWARDING"] = "namecheap.domains.dns.setEmailForwarding";
|
|
72
|
+
Commands2["DOMAINS_DNS_SETHOSTS"] = "namecheap.domains.dns.setHosts";
|
|
73
|
+
Commands2["DOMAINS_NS_CREATE"] = "namecheap.domains.ns.create";
|
|
74
|
+
Commands2["DOMAINS_NS_DELETE"] = "namecheap.domains.ns.delete";
|
|
75
|
+
Commands2["DOMAINS_NS_GETINFO"] = "namecheap.domains.ns.getInfo";
|
|
76
|
+
Commands2["DOMAINS_NS_UPDATE"] = "namecheap.domains.ns.update";
|
|
77
|
+
Commands2["DOMAINS_TRANSFER_CREATE"] = "namecheap.domains.transfer.create";
|
|
78
|
+
Commands2["DOMAINS_TRANSFER_GETSTATUS"] = "namecheap.domains.transfer.getStatus";
|
|
79
|
+
Commands2["DOMAINS_TRANSFER_UPDATESTATUS"] = "namecheap.domains.transfer.updateStatus";
|
|
80
|
+
Commands2["DOMAINS_TRANSFER_GETLIST"] = "namecheap.domains.transfer.getList";
|
|
81
|
+
Commands2["SSL_CREATE"] = "namecheap.ssl.create";
|
|
82
|
+
Commands2["SSL_GETLIST"] = "namecheap.ssl.getList";
|
|
83
|
+
Commands2["SSL_PARSECSR"] = "namecheap.ssl.parseCSR";
|
|
84
|
+
Commands2["SSL_GETAPPROVEREMAILLIST"] = "namecheap.ssl.getApproverEmailList";
|
|
85
|
+
Commands2["SSL_ACTIVATE"] = "namecheap.ssl.activate";
|
|
86
|
+
Commands2["SSL_RESENDAPPROVEREMAIL"] = "namecheap.ssl.resendApproverEmail";
|
|
87
|
+
Commands2["SSL_GETINFO"] = "namecheap.ssl.getInfo";
|
|
88
|
+
Commands2["SSL_RENEW"] = "namecheap.ssl.renew";
|
|
89
|
+
Commands2["SSL_REISSUE"] = "namecheap.ssl.reissue";
|
|
90
|
+
Commands2["SSL_RESENDFULFILLMENTEMAIL"] = "namecheap.ssl.resendfulfillmentemail";
|
|
91
|
+
Commands2["SSL_PURCHASEMORESANS"] = "namecheap.ssl.purchasemoresans";
|
|
92
|
+
Commands2["SSL_REVOKECERTIFICATE"] = "namecheap.ssl.revokecertificate";
|
|
93
|
+
Commands2["SSL_EDITDCVMETHOD"] = "namecheap.ssl.editDCVMethod";
|
|
94
|
+
Commands2["USERS_GETPRICING"] = "namecheap.users.getPricing";
|
|
95
|
+
Commands2["USERS_GETBALANCES"] = "namecheap.users.getBalances";
|
|
96
|
+
Commands2["USERS_CHANGEPASSWORD"] = "namecheap.users.changePassword";
|
|
97
|
+
Commands2["USERS_UPDATE"] = "namecheap.users.update";
|
|
98
|
+
Commands2["USERS_CREATEADDFUNDSREQUEST"] = "namecheap.users.createaddfundsrequest";
|
|
99
|
+
Commands2["USERS_GETADDFUNDSSTATUS"] = "namecheap.users.getAddFundsStatus";
|
|
100
|
+
Commands2["USERS_CREATE"] = "namecheap.users.create";
|
|
101
|
+
Commands2["USERS_LOGIN"] = "namecheap.users.login";
|
|
102
|
+
Commands2["USERS_RESETPASSWORD"] = "namecheap.users.resetPassword";
|
|
103
|
+
Commands2["USERS_ADDRESS_CREATE"] = "namecheap.users.address.create";
|
|
104
|
+
Commands2["USERS_ADDRESS_DELETE"] = "namecheap.users.address.delete";
|
|
105
|
+
Commands2["USERS_ADDRESS_GETINFO"] = "namecheap.users.address.getInfo";
|
|
106
|
+
Commands2["USERS_ADDRESS_GETLIST"] = "namecheap.users.address.getList";
|
|
107
|
+
Commands2["USERS_ADDRESS_SETDEFAULT"] = "namecheap.users.address.setDefault";
|
|
108
|
+
Commands2["USERS_ADDRESS_UPDATE"] = "namecheap.users.address.update";
|
|
109
|
+
Commands2["WHOISGUARD_CHANGEEMAILADDRESS"] = "Namecheap.Whoisguard.changeemailaddress";
|
|
110
|
+
Commands2["WHOISGUARD_ENABLE"] = "Namecheap.Whoisguard.enable";
|
|
111
|
+
Commands2["WHOISGUARD_DISABLE"] = "Namecheap.Whoisguard.disable";
|
|
112
|
+
Commands2["WHOISGUARD_GETLIST"] = "Namecheap.Whoisguard.getList";
|
|
113
|
+
Commands2["WHOISGUARD_RENEW"] = "Namecheap.Whoisguard.renew";
|
|
114
|
+
return Commands2;
|
|
115
|
+
})(Commands || {});
|
|
116
|
+
|
|
117
|
+
// src/types.ts
|
|
118
|
+
var DomainPriceActions = /* @__PURE__ */ ((DomainPriceActions2) => {
|
|
119
|
+
DomainPriceActions2["REGISTER"] = "REGISTER";
|
|
120
|
+
DomainPriceActions2["RENEW"] = "RENEW";
|
|
121
|
+
DomainPriceActions2["REACTIVATE"] = "REACTIVATE";
|
|
122
|
+
DomainPriceActions2["TRANSFER"] = "TRANSFER";
|
|
123
|
+
return DomainPriceActions2;
|
|
124
|
+
})(DomainPriceActions || {});
|
|
125
|
+
|
|
41
126
|
// src/api/api-client.ts
|
|
42
127
|
import axios from "axios";
|
|
43
|
-
import { parseStringPromise } from "xml2js";
|
|
44
128
|
|
|
45
129
|
// src/api/errors.ts
|
|
46
130
|
var XMLParsingError = class extends Error {
|
|
@@ -57,6 +141,24 @@ var ResponseError = class extends Error {
|
|
|
57
141
|
}
|
|
58
142
|
};
|
|
59
143
|
|
|
144
|
+
// src/api/utils.ts
|
|
145
|
+
import { parseStringPromise } from "xml2js";
|
|
146
|
+
function parseXMLString(xml) {
|
|
147
|
+
return parseStringPromise(xml, {
|
|
148
|
+
explicitArray: false,
|
|
149
|
+
attrValueProcessors: [transformValues]
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
function transformValues(value, name) {
|
|
153
|
+
if (value === "false" || value === "true") {
|
|
154
|
+
return value === "true";
|
|
155
|
+
}
|
|
156
|
+
if (!isNaN(+value)) {
|
|
157
|
+
return +value;
|
|
158
|
+
}
|
|
159
|
+
return value;
|
|
160
|
+
}
|
|
161
|
+
|
|
60
162
|
// src/api/api-client.ts
|
|
61
163
|
var APIClient = class {
|
|
62
164
|
constructor(baseURL) {
|
|
@@ -68,14 +170,19 @@ var APIClient = class {
|
|
|
68
170
|
return yield this._client.get(url);
|
|
69
171
|
});
|
|
70
172
|
}
|
|
173
|
+
post(url) {
|
|
174
|
+
return __async(this, null, function* () {
|
|
175
|
+
return yield this._client.post(url);
|
|
176
|
+
});
|
|
177
|
+
}
|
|
71
178
|
onResponse(response) {
|
|
72
179
|
return __async(this, null, function* () {
|
|
73
180
|
try {
|
|
74
|
-
const result = yield
|
|
181
|
+
const result = yield parseXMLString(response.data);
|
|
75
182
|
if (result.ApiResponse.$.Status === "ERROR") {
|
|
76
183
|
const responseErrors = result.ApiResponse.Errors;
|
|
77
|
-
const code = responseErrors
|
|
78
|
-
const message = responseErrors
|
|
184
|
+
const code = responseErrors.Error.$.Number;
|
|
185
|
+
const message = responseErrors.Error._;
|
|
79
186
|
throw new ResponseError(message, code);
|
|
80
187
|
}
|
|
81
188
|
response.data = result.ApiResponse.CommandResponse;
|
|
@@ -92,6 +199,14 @@ var APIClient = class {
|
|
|
92
199
|
};
|
|
93
200
|
var api_client_default = APIClient;
|
|
94
201
|
|
|
202
|
+
// src/exceptions/InvalidDomainNameException.ts
|
|
203
|
+
var InvalidDomainNameException = class extends Error {
|
|
204
|
+
constructor(domainName) {
|
|
205
|
+
super(`The provided domain name [${domainName}] is not valid`);
|
|
206
|
+
this.name = "InvalidDomainNameException";
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
|
|
95
210
|
// src/namecheap.ts
|
|
96
211
|
var Namecheap = class {
|
|
97
212
|
constructor(config, sandbox) {
|
|
@@ -101,17 +216,110 @@ var Namecheap = class {
|
|
|
101
216
|
}
|
|
102
217
|
call(command, payload) {
|
|
103
218
|
return __async(this, null, function* () {
|
|
104
|
-
const
|
|
219
|
+
const _a = this.config, { username } = _a, config = __objRest(_a, ["username"]);
|
|
220
|
+
const params = __spreadProps(__spreadValues(__spreadValues({
|
|
221
|
+
username
|
|
222
|
+
}, payload), config), {
|
|
105
223
|
command
|
|
106
224
|
});
|
|
107
225
|
const url = "?" + new URLSearchParams(params).toString();
|
|
108
|
-
const { data, status } = yield this.apiClient.
|
|
226
|
+
const { data, status } = yield this.apiClient.post(url);
|
|
109
227
|
return { data, status };
|
|
110
228
|
});
|
|
111
229
|
}
|
|
230
|
+
checkDomain(domainName) {
|
|
231
|
+
return __async(this, null, function* () {
|
|
232
|
+
const { data, status } = yield this.call("namecheap.domains.check" /* DOMAINS_CHECK */, {
|
|
233
|
+
DomainList: domainName
|
|
234
|
+
});
|
|
235
|
+
const response = {
|
|
236
|
+
data: {
|
|
237
|
+
availabe: data.DomainCheckResult.$.Available,
|
|
238
|
+
premium: data.DomainCheckResult.$.IsPremiumName
|
|
239
|
+
},
|
|
240
|
+
status
|
|
241
|
+
};
|
|
242
|
+
return response;
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
getDomainPrice(domainName, action) {
|
|
246
|
+
return __async(this, null, function* () {
|
|
247
|
+
var _a, _b, _c, _d;
|
|
248
|
+
const [_, tld] = domainName.split(".");
|
|
249
|
+
if (!tld) {
|
|
250
|
+
throw new InvalidDomainNameException(domainName);
|
|
251
|
+
}
|
|
252
|
+
const { data, status } = yield this.call("namecheap.users.getPricing" /* USERS_GETPRICING */, {
|
|
253
|
+
ProductType: "DOMAIN",
|
|
254
|
+
ProductCategory: "DOMAINS",
|
|
255
|
+
ActionName: action,
|
|
256
|
+
ProductName: tld
|
|
257
|
+
});
|
|
258
|
+
const pricing = (((_d = (_c = (_b = (_a = data.UserGetPricingResult) == null ? void 0 : _a.ProductType) == null ? void 0 : _b.ProductCategory) == null ? void 0 : _c.Product) == null ? void 0 : _d.Price) || []).map((price) => __spreadValues({}, price.$));
|
|
259
|
+
return { data: pricing, status };
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
registerDomain(payload) {
|
|
263
|
+
return __async(this, null, function* () {
|
|
264
|
+
var _a;
|
|
265
|
+
const { data, status } = yield this.call("namecheap.domains.create" /* DOMAINS_CREATE */, payload);
|
|
266
|
+
const result = (_a = data == null ? void 0 : data.DomainCreateResult) == null ? void 0 : _a.$;
|
|
267
|
+
const response = {
|
|
268
|
+
data: {
|
|
269
|
+
domain: result.Domain,
|
|
270
|
+
registered: result.Registered,
|
|
271
|
+
chargedAmount: result.ChargedAmount,
|
|
272
|
+
domainID: result.DomainID,
|
|
273
|
+
orderID: result.OrderID,
|
|
274
|
+
transactionID: result.TransactionID,
|
|
275
|
+
whoisguardEnable: result.WhoisguardEnable,
|
|
276
|
+
freePositiveSSL: result.FreePositiveSSL,
|
|
277
|
+
nonRealTimeDomain: result.NonRealTimeDomain
|
|
278
|
+
},
|
|
279
|
+
status
|
|
280
|
+
};
|
|
281
|
+
return response;
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
addFundsRequest(payload) {
|
|
285
|
+
return __async(this, null, function* () {
|
|
286
|
+
const { data, status } = yield this.call(
|
|
287
|
+
"namecheap.users.createaddfundsrequest" /* USERS_CREATEADDFUNDSREQUEST */,
|
|
288
|
+
payload
|
|
289
|
+
);
|
|
290
|
+
const result = data.Createaddfundsrequestresult.$;
|
|
291
|
+
const response = {
|
|
292
|
+
data: {
|
|
293
|
+
tokenId: result.TokenID,
|
|
294
|
+
returnURL: result.ReturnURL,
|
|
295
|
+
redirectURL: result.RedirectURL
|
|
296
|
+
},
|
|
297
|
+
status
|
|
298
|
+
};
|
|
299
|
+
return response;
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
getFundsStatus(tokenId) {
|
|
303
|
+
return __async(this, null, function* () {
|
|
304
|
+
const { data, status } = yield this.call("namecheap.users.getAddFundsStatus" /* USERS_GETADDFUNDSSTATUS */, {
|
|
305
|
+
tokenId
|
|
306
|
+
});
|
|
307
|
+
const result = data.GetAddFundsStatusResult.$;
|
|
308
|
+
const response = {
|
|
309
|
+
data: {
|
|
310
|
+
amount: result.Amount,
|
|
311
|
+
status: result.Status
|
|
312
|
+
},
|
|
313
|
+
status
|
|
314
|
+
};
|
|
315
|
+
return response;
|
|
316
|
+
});
|
|
317
|
+
}
|
|
112
318
|
};
|
|
113
319
|
var namecheap_default = Namecheap;
|
|
114
320
|
export {
|
|
321
|
+
Commands,
|
|
322
|
+
DomainPriceActions,
|
|
115
323
|
namecheap_default as default
|
|
116
324
|
};
|
|
117
325
|
//# 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/api/utils.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 type Payload = Record<string, string | number>;\r\n\r\nexport interface IReponse<T = any> {\r\n data: T;\r\n status: number;\r\n}\r\n\r\nexport type ICheckDomainResponse = IReponse<{\r\n availabe: boolean;\r\n premium: boolean;\r\n}>;\r\n\r\nexport type IRegisterDomainResponse = IReponse<{\r\n domain: string;\r\n registered: boolean;\r\n chargedAmount: number;\r\n domainID: string;\r\n orderID: string;\r\n transactionID: string;\r\n whoisguardEnable: boolean;\r\n freePositiveSSL: boolean;\r\n nonRealTimeDomain: boolean;\r\n}>;\r\n\r\nexport type IAddFundsRequestResponse = IReponse<{\r\n tokenId: string;\r\n returnURL: string;\r\n redirectURL: string;\r\n}>;\r\n\r\nexport type IGetFundsStatusResponse = IReponse<{\r\n status: string;\r\n amount: number;\r\n}>;\r\n\r\nexport 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\r\nexport type AddFundsRequestPayload = {\r\n username: string;\r\n paymentType: \"creditcard\";\r\n amount: number;\r\n returnURL: string;\r\n};\r\n","import axios, { AxiosInstance, AxiosResponse } from \"axios\";\r\nimport { ResponseError, XMLParsingError } from \"./errors\";\r\nimport { parseXMLString } from \"./utils\";\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 async post(url: string) {\r\n return await this._client.post(url);\r\n }\r\n\r\n private async onResponse(response: AxiosResponse): Promise<AxiosResponse> {\r\n try {\r\n const result = await parseXMLString(response.data);\r\n\r\n if (result.ApiResponse.$.Status === \"ERROR\") {\r\n const responseErrors = result.ApiResponse.Errors;\r\n const code = responseErrors.Error.$.Number;\r\n const message = responseErrors.Error._;\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 { parseStringPromise } from \"xml2js\";\r\n\r\nexport function parseXMLString(xml: string): Promise<any> {\r\n return parseStringPromise(xml, {\r\n explicitArray: false,\r\n attrValueProcessors: [transformValues],\r\n });\r\n}\r\n\r\nfunction transformValues(value: string, name: string) {\r\n // check boolean\r\n if (value === \"false\" || value === \"true\") {\r\n return value === \"true\";\r\n }\r\n\r\n // check numbers\r\n if (!isNaN(+value)) {\r\n return +value;\r\n }\r\n\r\n return value;\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 {\r\n AddFundsRequestPayload,\r\n DomainPriceAction,\r\n IAddFundsRequestResponse,\r\n ICheckDomainResponse,\r\n IGetFundsStatusResponse,\r\n IRegisterDomainResponse,\r\n IReponse,\r\n Payload,\r\n} 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\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(command: Command, payload: Payload): Promise<IReponse> {\r\n const { username, ...config } = this.config;\r\n\r\n const params = {\r\n username,\r\n ...payload,\r\n ...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.post(url);\r\n\r\n return { data, status };\r\n }\r\n\r\n async checkDomain(domainName: string): Promise<ICheckDomainResponse> {\r\n const { data, status } = await this.call(Commands.DOMAINS_CHECK, {\r\n DomainList: domainName,\r\n });\r\n\r\n const response: ICheckDomainResponse = {\r\n data: {\r\n availabe: data.DomainCheckResult.$.Available,\r\n premium: data.DomainCheckResult.$.IsPremiumName,\r\n },\r\n status,\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<object[]>> {\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: object[] = (\r\n data.UserGetPricingResult?.ProductType?.ProductCategory?.Product?.Price ||\r\n []\r\n ).map((price: any) => ({ ...price.$ }));\r\n\r\n return { data: pricing, status };\r\n }\r\n\r\n async registerDomain(payload: Payload): Promise<IRegisterDomainResponse> {\r\n const { data, status } = await this.call(Commands.DOMAINS_CREATE, payload);\r\n\r\n const result = data?.DomainCreateResult?.$;\r\n\r\n const response: IRegisterDomainResponse = {\r\n data: {\r\n domain: result.Domain,\r\n registered: result.Registered,\r\n chargedAmount: result.ChargedAmount,\r\n domainID: result.DomainID,\r\n orderID: result.OrderID,\r\n transactionID: result.TransactionID,\r\n whoisguardEnable: result.WhoisguardEnable,\r\n freePositiveSSL: result.FreePositiveSSL,\r\n nonRealTimeDomain: result.NonRealTimeDomain,\r\n },\r\n status,\r\n };\r\n\r\n return response;\r\n }\r\n\r\n async addFundsRequest(\r\n payload: AddFundsRequestPayload\r\n ): Promise<IAddFundsRequestResponse> {\r\n const { data, status } = await this.call(\r\n Commands.USERS_CREATEADDFUNDSREQUEST,\r\n payload\r\n );\r\n\r\n const result = data.Createaddfundsrequestresult.$;\r\n\r\n const response: IAddFundsRequestResponse = {\r\n data: {\r\n tokenId: result.TokenID,\r\n returnURL: result.ReturnURL,\r\n redirectURL: result.RedirectURL,\r\n },\r\n status,\r\n };\r\n\r\n return response;\r\n }\r\n\r\n async getFundsStatus(tokenId: string): Promise<IGetFundsStatusResponse> {\r\n const { data, status } = await this.call(Commands.USERS_GETADDFUNDSSTATUS, {\r\n tokenId,\r\n });\r\n\r\n const result = data.GetAddFundsStatusResult.$;\r\n\r\n const response: IGetFundsStatusResponse = {\r\n data: {\r\n amount: result.Amount,\r\n status: result.Status,\r\n },\r\n status,\r\n };\r\n\r\n return response;\r\n }\r\n}\r\n\r\nexport default Namecheap;\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAO,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,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T;AAAA;AAAA,EAEM,gBACJ,SACmC;AAAA;AACnC,YAAM,EAAE,MAAM,OAAO,IAAI,MAAM,KAAK;AAAA;AAAA,QAElC;AAAA,MACF;AAEA,YAAM,SAAS,KAAK,4BAA4B;AAEhD,YAAM,WAAqC;AAAA,QACzC,MAAM;AAAA,UACJ,SAAS,OAAO;AAAA,UAChB,WAAW,OAAO;AAAA,UAClB,aAAa,OAAO;AAAA,QACtB;AAAA,QACA;AAAA,MACF;AAEA,aAAO;AAAA,IACT;AAAA;AAAA,EAEM,eAAe,SAAmD;AAAA;AACtE,YAAM,EAAE,MAAM,OAAO,IAAI,MAAM,KAAK,wEAAuC;AAAA,QACzE;AAAA,MACF,CAAC;AAED,YAAM,SAAS,KAAK,wBAAwB;AAE5C,YAAM,WAAoC;AAAA,QACxC,MAAM;AAAA,UACJ,QAAQ,OAAO;AAAA,UACf,QAAQ,OAAO;AAAA,QACjB;AAAA,QACA;AAAA,MACF;AAEA,aAAO;AAAA,IACT;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.4",
|
|
4
4
|
"description": "A simple wrapper for namecheap API",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
],
|
|
11
11
|
"scripts": {
|
|
12
12
|
"start": "tsc --build && node dist/index.js",
|
|
13
|
-
"build": "tsup",
|
|
13
|
+
"build": "rm -rf dist && tsup",
|
|
14
|
+
"release": "rm -rf dist && tsup && npm publish",
|
|
14
15
|
"test": "jest"
|
|
15
16
|
},
|
|
16
17
|
"keywords": [
|
package/dist/api/api-client.d.ts
DELETED
package/dist/api/api-client.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
const axios_1 = __importDefault(require("axios"));
|
|
16
|
-
const xml2js_1 = require("xml2js");
|
|
17
|
-
const errors_1 = require("./errors");
|
|
18
|
-
class APIClient {
|
|
19
|
-
constructor(baseURL) {
|
|
20
|
-
this._client = axios_1.default.create({ baseURL });
|
|
21
|
-
this._client.interceptors.response.use(this.onResponse);
|
|
22
|
-
}
|
|
23
|
-
get(url) {
|
|
24
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
25
|
-
return yield this._client.get(url);
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
onResponse(response) {
|
|
29
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
30
|
-
try {
|
|
31
|
-
const result = yield (0, xml2js_1.parseStringPromise)(response.data);
|
|
32
|
-
if (result.ApiResponse.$.Status === "ERROR") {
|
|
33
|
-
const responseErrors = result.ApiResponse.Errors;
|
|
34
|
-
const code = responseErrors[0].Error[0].$.Number;
|
|
35
|
-
const message = responseErrors[0].Error[0]._;
|
|
36
|
-
throw new errors_1.ResponseError(message, code);
|
|
37
|
-
}
|
|
38
|
-
response.data = result.ApiResponse.CommandResponse;
|
|
39
|
-
}
|
|
40
|
-
catch (err) {
|
|
41
|
-
response.status = 400;
|
|
42
|
-
if (err instanceof errors_1.ResponseError) {
|
|
43
|
-
throw err;
|
|
44
|
-
}
|
|
45
|
-
throw new errors_1.XMLParsingError();
|
|
46
|
-
}
|
|
47
|
-
return response;
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
exports.default = APIClient;
|
package/dist/api/errors.d.ts
DELETED
package/dist/api/errors.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ResponseError = exports.XMLParsingError = void 0;
|
|
4
|
-
class XMLParsingError extends Error {
|
|
5
|
-
constructor() {
|
|
6
|
-
super("Invalid XML response");
|
|
7
|
-
this.name = "XMLParsingError";
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
exports.XMLParsingError = XMLParsingError;
|
|
11
|
-
class ResponseError extends Error {
|
|
12
|
-
constructor(message, code) {
|
|
13
|
-
super((code ? `${code}: ` : "") + message);
|
|
14
|
-
this.code = code;
|
|
15
|
-
this.name = "ResponseError";
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
exports.ResponseError = ResponseError;
|
package/dist/api/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./api-client";
|
package/dist/api/index.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var api_client_1 = require("./api-client");
|
|
8
|
-
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(api_client_1).default; } });
|
package/dist/commands.d.ts
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
export 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
|
-
export type Command = `${Commands}`;
|
package/dist/commands.js
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Commands = void 0;
|
|
4
|
-
var Commands;
|
|
5
|
-
(function (Commands) {
|
|
6
|
-
// domains
|
|
7
|
-
Commands["DOMAINS_GETLIST"] = "namecheap.domains.getList";
|
|
8
|
-
Commands["DOMAINS_GETCONTACTS"] = "namecheap.domains.getContacts";
|
|
9
|
-
Commands["DOMAINS_CREATE"] = "namecheap.domains.create";
|
|
10
|
-
Commands["DOMAINS_GETTLDLIST"] = "namecheap.domains.getTldList";
|
|
11
|
-
Commands["DOMAINS_SETCONTACTS"] = "namecheap.domains.setContacts";
|
|
12
|
-
Commands["DOMAINS_CHECK"] = "namecheap.domains.check";
|
|
13
|
-
Commands["DOMAINS_REACTIVATE"] = "namecheap.domains.reactivate";
|
|
14
|
-
Commands["DOMAINS_RENEW"] = "namecheap.domains.renew";
|
|
15
|
-
Commands["DOMAINS_GETREGISTRARLOCK"] = "namecheap.domains.getRegistrarLock";
|
|
16
|
-
Commands["DOMAINS_SETREGISTRARLOCK"] = "namecheap.domains.setRegistrarLock";
|
|
17
|
-
Commands["DOMAINS_GETINFO"] = "namecheap.domains.getInfo";
|
|
18
|
-
// domains.dns
|
|
19
|
-
Commands["DOMAINS_DNS_SETDEFAULT"] = "namecheap.domains.dns.setDefault";
|
|
20
|
-
Commands["DOMAINS_DNS_SETCUSTOM"] = "namecheap.domains.dns.setCustom";
|
|
21
|
-
Commands["DOMAINS_DNS_GETLIST"] = "namecheap.domains.dns.getList";
|
|
22
|
-
Commands["DOMAINS_DNS_GETHOSTS"] = "namecheap.domains.dns.getHosts";
|
|
23
|
-
Commands["DOMAINS_DNS_GETEMAILFORWARDING"] = "namecheap.domains.dns.getEmailForwarding";
|
|
24
|
-
Commands["DOMAINS_DNS_SETEMAILFORWARDING"] = "namecheap.domains.dns.setEmailForwarding";
|
|
25
|
-
Commands["DOMAINS_DNS_SETHOSTS"] = "namecheap.domains.dns.setHosts";
|
|
26
|
-
// domains.ns
|
|
27
|
-
Commands["DOMAINS_NS_CREATE"] = "namecheap.domains.ns.create";
|
|
28
|
-
Commands["DOMAINS_NS_DELETE"] = "namecheap.domains.ns.delete";
|
|
29
|
-
Commands["DOMAINS_NS_GETINFO"] = "namecheap.domains.ns.getInfo";
|
|
30
|
-
Commands["DOMAINS_NS_UPDATE"] = "namecheap.domains.ns.update";
|
|
31
|
-
// domains.transfer
|
|
32
|
-
Commands["DOMAINS_TRANSFER_CREATE"] = "namecheap.domains.transfer.create";
|
|
33
|
-
Commands["DOMAINS_TRANSFER_GETSTATUS"] = "namecheap.domains.transfer.getStatus";
|
|
34
|
-
Commands["DOMAINS_TRANSFER_UPDATESTATUS"] = "namecheap.domains.transfer.updateStatus";
|
|
35
|
-
Commands["DOMAINS_TRANSFER_GETLIST"] = "namecheap.domains.transfer.getList";
|
|
36
|
-
// ssl
|
|
37
|
-
Commands["SSL_CREATE"] = "namecheap.ssl.create";
|
|
38
|
-
Commands["SSL_GETLIST"] = "namecheap.ssl.getList";
|
|
39
|
-
Commands["SSL_PARSECSR"] = "namecheap.ssl.parseCSR";
|
|
40
|
-
Commands["SSL_GETAPPROVEREMAILLIST"] = "namecheap.ssl.getApproverEmailList";
|
|
41
|
-
Commands["SSL_ACTIVATE"] = "namecheap.ssl.activate";
|
|
42
|
-
Commands["SSL_RESENDAPPROVEREMAIL"] = "namecheap.ssl.resendApproverEmail";
|
|
43
|
-
Commands["SSL_GETINFO"] = "namecheap.ssl.getInfo";
|
|
44
|
-
Commands["SSL_RENEW"] = "namecheap.ssl.renew";
|
|
45
|
-
Commands["SSL_REISSUE"] = "namecheap.ssl.reissue";
|
|
46
|
-
Commands["SSL_RESENDFULFILLMENTEMAIL"] = "namecheap.ssl.resendfulfillmentemail";
|
|
47
|
-
Commands["SSL_PURCHASEMORESANS"] = "namecheap.ssl.purchasemoresans";
|
|
48
|
-
Commands["SSL_REVOKECERTIFICATE"] = "namecheap.ssl.revokecertificate";
|
|
49
|
-
Commands["SSL_EDITDCVMETHOD"] = "namecheap.ssl.editDCVMethod";
|
|
50
|
-
// users
|
|
51
|
-
Commands["USERS_GETPRICING"] = "namecheap.users.getPricing";
|
|
52
|
-
Commands["USERS_GETBALANCES"] = "namecheap.users.getBalances";
|
|
53
|
-
Commands["USERS_CHANGEPASSWORD"] = "namecheap.users.changePassword";
|
|
54
|
-
Commands["USERS_UPDATE"] = "namecheap.users.update";
|
|
55
|
-
Commands["USERS_CREATEADDFUNDSREQUEST"] = "namecheap.users.createaddfundsrequest";
|
|
56
|
-
Commands["USERS_GETADDFUNDSSTATUS"] = "namecheap.users.getAddFundsStatus";
|
|
57
|
-
Commands["USERS_CREATE"] = "namecheap.users.create";
|
|
58
|
-
Commands["USERS_LOGIN"] = "namecheap.users.login";
|
|
59
|
-
Commands["USERS_RESETPASSWORD"] = "namecheap.users.resetPassword";
|
|
60
|
-
// users.address
|
|
61
|
-
Commands["USERS_ADDRESS_CREATE"] = "namecheap.users.address.create";
|
|
62
|
-
Commands["USERS_ADDRESS_DELETE"] = "namecheap.users.address.delete";
|
|
63
|
-
Commands["USERS_ADDRESS_GETINFO"] = "namecheap.users.address.getInfo";
|
|
64
|
-
Commands["USERS_ADDRESS_GETLIST"] = "namecheap.users.address.getList";
|
|
65
|
-
Commands["USERS_ADDRESS_SETDEFAULT"] = "namecheap.users.address.setDefault";
|
|
66
|
-
Commands["USERS_ADDRESS_UPDATE"] = "namecheap.users.address.update";
|
|
67
|
-
// domainprivacy
|
|
68
|
-
Commands["WHOISGUARD_CHANGEEMAILADDRESS"] = "Namecheap.Whoisguard.changeemailaddress";
|
|
69
|
-
Commands["WHOISGUARD_ENABLE"] = "Namecheap.Whoisguard.enable";
|
|
70
|
-
Commands["WHOISGUARD_DISABLE"] = "Namecheap.Whoisguard.disable";
|
|
71
|
-
Commands["WHOISGUARD_GETLIST"] = "Namecheap.Whoisguard.getList";
|
|
72
|
-
Commands["WHOISGUARD_RENEW"] = "Namecheap.Whoisguard.renew";
|
|
73
|
-
})(Commands || (exports.Commands = Commands = {}));
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.InvalidDomainNameException = void 0;
|
|
4
|
-
class InvalidDomainNameException extends Error {
|
|
5
|
-
constructor(domainName) {
|
|
6
|
-
super(`The provided domain name [${domainName}] is not valid`);
|
|
7
|
-
this.name = "InvalidDomainNameException";
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
exports.InvalidDomainNameException = InvalidDomainNameException;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.InvalidTLDException = void 0;
|
|
4
|
-
class InvalidTLDException extends Error {
|
|
5
|
-
constructor(tld) {
|
|
6
|
-
super(`The provided tld [${tld}] is not valid`);
|
|
7
|
-
this.name = "InvalidTLDException";
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
exports.InvalidTLDException = InvalidTLDException;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./InvalidDomainNameException";
|
package/dist/exceptions/index.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./InvalidDomainNameException"), exports);
|