domrobot-client 3.2.0 → 3.2.2
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.
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
name: format-lint.yaml
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
branches:
|
|
6
|
+
- master
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
format:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/checkout@v4
|
|
13
|
+
- uses: actions/setup-node@v4
|
|
14
|
+
with:
|
|
15
|
+
node-version: '20'
|
|
16
|
+
- run: npm ci
|
|
17
|
+
- name: Prettier check
|
|
18
|
+
run: npm run format:check
|
|
19
|
+
- name: Lint the code
|
|
20
|
+
run: npm run lint
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
name: Publish Package to npmjs
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
build:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
permissions:
|
|
11
|
+
contents: read
|
|
12
|
+
id-token: write
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v4
|
|
15
|
+
- uses: actions/setup-node@v4
|
|
16
|
+
with:
|
|
17
|
+
node-version: '20.x'
|
|
18
|
+
registry-url: 'https://registry.npmjs.org'
|
|
19
|
+
- run: npm ci
|
|
20
|
+
- run: npm publish --provenance --access public
|
|
21
|
+
env:
|
|
22
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
package/lib/domrobot.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ export declare class ApiClient {
|
|
|
23
23
|
* @param cacheOption HTTP cache options
|
|
24
24
|
* @param nextjsOptions Next.js options
|
|
25
25
|
*/
|
|
26
|
-
callApi(apiMethod: string, methodParams?: any, clientTransactionId?: string, language?: string, cacheOption?:
|
|
26
|
+
callApi(apiMethod: string, methodParams?: any, clientTransactionId?: string, language?: string, cacheOption?: 'no-store' | 'reload' | 'no-cache' | 'force-cache' | 'only-if-cached' | 'default', nextjsOptions?: object): Promise<any>;
|
|
27
27
|
/**
|
|
28
28
|
* Performs a login at the API and saves the session for following API calls.
|
|
29
29
|
*
|
|
@@ -42,6 +42,7 @@ export declare class ApiClient {
|
|
|
42
42
|
isDebugMode(): boolean;
|
|
43
43
|
setDebugMode(value: boolean): void;
|
|
44
44
|
getCookie(): string;
|
|
45
|
+
setCookie(cookie: string): void;
|
|
45
46
|
}
|
|
46
47
|
/**
|
|
47
48
|
* The API response-message language.
|
package/lib/domrobot.js
CHANGED
|
@@ -36,8 +36,8 @@ class ApiClient {
|
|
|
36
36
|
* @param cacheOption HTTP cache options
|
|
37
37
|
* @param nextjsOptions Next.js options
|
|
38
38
|
*/
|
|
39
|
-
callApi(
|
|
40
|
-
return __awaiter(this,
|
|
39
|
+
callApi(apiMethod_1) {
|
|
40
|
+
return __awaiter(this, arguments, void 0, function* (apiMethod, methodParams = {}, clientTransactionId = ApiClient.generateClientTransactionId(), language = this.language, cacheOption, nextjsOptions) {
|
|
41
41
|
if ('clTRID' in methodParams && clientTransactionId !== null) {
|
|
42
42
|
methodParams.clTRID = clientTransactionId;
|
|
43
43
|
}
|
|
@@ -56,7 +56,7 @@ class ApiClient {
|
|
|
56
56
|
'User-Agent': `DomRobot/${ApiClient.CLIENT_VERSION} (Node ${process.version})`,
|
|
57
57
|
}),
|
|
58
58
|
body: requestBody,
|
|
59
|
-
cache: cacheOption !== null && cacheOption !== void 0 ? cacheOption :
|
|
59
|
+
cache: cacheOption !== null && cacheOption !== void 0 ? cacheOption : 'default',
|
|
60
60
|
};
|
|
61
61
|
if (nextjsOptions !== undefined) {
|
|
62
62
|
fetchOption = Object.assign(Object.assign({}, fetchOption), nextjsOptions);
|
|
@@ -80,8 +80,8 @@ class ApiClient {
|
|
|
80
80
|
* @param password your password.
|
|
81
81
|
* @param sharedSecret
|
|
82
82
|
*/
|
|
83
|
-
login(
|
|
84
|
-
return __awaiter(this,
|
|
83
|
+
login(username_1, password_1) {
|
|
84
|
+
return __awaiter(this, arguments, void 0, function* (username, password, sharedSecret = null) {
|
|
85
85
|
const loginResult = yield this.callApi('account.login', { user: username, pass: password });
|
|
86
86
|
if (loginResult.code === 1000 && 'tfa' in loginResult.resData && loginResult.resData.tfa !== '0') {
|
|
87
87
|
if (sharedSecret === null) {
|
|
@@ -122,6 +122,9 @@ class ApiClient {
|
|
|
122
122
|
getCookie() {
|
|
123
123
|
return this.cookie;
|
|
124
124
|
}
|
|
125
|
+
setCookie(cookie) {
|
|
126
|
+
this.cookie = cookie;
|
|
127
|
+
}
|
|
125
128
|
}
|
|
126
129
|
exports.ApiClient = ApiClient;
|
|
127
130
|
ApiClient.CLIENT_VERSION = '3.0.2';
|
package/lib/domrobot.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"domrobot.js","sourceRoot":"","sources":["../src/domrobot.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iCAAiC;AAEjC,MAAa,SAAS;IAMX,MAAM,CAAC,2BAA2B;QACrC,OAAO,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,UAAU,CAAC,CAAC;IAChE,CAAC;IAQD;;;;OAIG;IACH,YAAY,SAAiB,SAAS,CAAC,WAAW,EAAE,WAAmB,QAAQ,CAAC,EAAE,EAAE,YAAqB,KAAK;QAC1G,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;IACvB,CAAC;IAED;;;;;;;;;OASG;IACU,OAAO,
|
|
1
|
+
{"version":3,"file":"domrobot.js","sourceR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,CAAA;IACT,qBAAS,CAAA;AACb,CAAC,EAJW,QAAQ,wBAAR,QAAQ,QAInB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"domaincheck.js","sourceRoot":"","sources":["../../src/examples/domaincheck.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,0CAAkD;AAElD,MAAM,QAAQ,GAAG,EAAE,CAAC;AACpB,MAAM,QAAQ,GAAG,EAAE,CAAC;AACpB,MAAM,YAAY,GAAG,EAAE,CAAC,CAAC,uBAAuB;AAChD,MAAM,MAAM,GAAG,iBAAiB,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,CAAC,GAAG,MAAM,CAAC,CAAC,oCAAoC;AAEjH,MAAM,SAAS,GAAG,GAAS,EAAE;IACzB,kGAAkG;IAClG,wHAAwH;IACxH,MAAM,SAAS,GAAG,IAAI,oBAAS,CAAC,oBAAS,CAAC,WAAW,EAAE,mBAAQ,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;IAE1E,MAAM,aAAa,GAAG,MAAM,SAAS,CAAC,KAAK,CAAC,QAAQ,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAC;IAC9E,IAAI,aAAa,CAAC,IAAI,KAAK,IAAI,EAAE;
|
|
1
|
+
{"version":3,"file":"domaincheck.js","sourceRoot":"","sources":["../../src/examples/domaincheck.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,0CAAkD;AAElD,MAAM,QAAQ,GAAG,EAAE,CAAC;AACpB,MAAM,QAAQ,GAAG,EAAE,CAAC;AACpB,MAAM,YAAY,GAAG,EAAE,CAAC,CAAC,uBAAuB;AAChD,MAAM,MAAM,GAAG,iBAAiB,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,CAAC,GAAG,MAAM,CAAC,CAAC,oCAAoC;AAEjH,MAAM,SAAS,GAAG,GAAS,EAAE;IACzB,kGAAkG;IAClG,wHAAwH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C"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "domrobot-client",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.2",
|
|
4
4
|
"description": "INWX Domrobot Node.JS Client",
|
|
5
5
|
"author": "INWX Developer <developer@inwx.de> (https://inwx.com)",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
"scripts": {
|
|
23
23
|
"build": "tsc",
|
|
24
24
|
"format": "prettier --write \"src/**/*.ts\"",
|
|
25
|
+
"format:check": "prettier --check \"src/**/*.ts\"",
|
|
25
26
|
"lint": "eslint \"src/**/*.ts\"",
|
|
26
27
|
"prepare": "npm run build"
|
|
27
28
|
},
|
|
@@ -29,14 +30,14 @@
|
|
|
29
30
|
"otplib": "^12.0.1"
|
|
30
31
|
},
|
|
31
32
|
"devDependencies": {
|
|
32
|
-
"@types/node": "^
|
|
33
|
+
"@types/node": "^22.2.0",
|
|
33
34
|
"@types/otplib": "^7.0.0",
|
|
34
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
35
|
+
"@typescript-eslint/eslint-plugin": "^8.1.0",
|
|
35
36
|
"browserify": "^17.0.0",
|
|
36
37
|
"eslint": "^8.44.0",
|
|
37
38
|
"eslint-config-prettier": "^8.8.0",
|
|
38
|
-
"prettier": "^
|
|
39
|
-
"typescript": "^5.
|
|
39
|
+
"prettier": "^3.3.3",
|
|
40
|
+
"typescript": "^5.5.4"
|
|
40
41
|
},
|
|
41
42
|
"engines": {
|
|
42
43
|
"node": ">=18"
|
package/src/domrobot.ts
CHANGED
|
@@ -43,8 +43,8 @@ export class ApiClient {
|
|
|
43
43
|
methodParams: any = {},
|
|
44
44
|
clientTransactionId: string = ApiClient.generateClientTransactionId(),
|
|
45
45
|
language: string = this.language,
|
|
46
|
-
cacheOption?:
|
|
47
|
-
nextjsOptions?: object
|
|
46
|
+
cacheOption?: 'no-store' | 'reload' | 'no-cache' | 'force-cache' | 'only-if-cached' | 'default',
|
|
47
|
+
nextjsOptions?: object,
|
|
48
48
|
): Promise<any> {
|
|
49
49
|
if ('clTRID'! in methodParams && clientTransactionId !== null) {
|
|
50
50
|
methodParams.clTRID = clientTransactionId;
|
|
@@ -66,11 +66,11 @@ export class ApiClient {
|
|
|
66
66
|
'User-Agent': `DomRobot/${ApiClient.CLIENT_VERSION} (Node ${process.version})`,
|
|
67
67
|
}),
|
|
68
68
|
body: requestBody,
|
|
69
|
-
cache: cacheOption ??
|
|
69
|
+
cache: cacheOption ?? 'default',
|
|
70
70
|
};
|
|
71
71
|
|
|
72
72
|
if (nextjsOptions !== undefined) {
|
|
73
|
-
fetchOption = {...fetchOption, ...nextjsOptions};
|
|
73
|
+
fetchOption = { ...fetchOption, ...nextjsOptions };
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
const response = await fetch(this.apiUrl, fetchOption);
|
|
@@ -79,7 +79,7 @@ export class ApiClient {
|
|
|
79
79
|
this.cookie = response.headers.get('set-cookie');
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
const data = await response.json()
|
|
82
|
+
const data = await response.json();
|
|
83
83
|
if (this.debugMode) {
|
|
84
84
|
console.info(`Request (${apiMethod}): ${requestBody}`);
|
|
85
85
|
console.info(`Response (${apiMethod}): ${JSON.stringify(data)}`);
|
|
@@ -141,6 +141,10 @@ export class ApiClient {
|
|
|
141
141
|
public getCookie(): string {
|
|
142
142
|
return this.cookie;
|
|
143
143
|
}
|
|
144
|
+
|
|
145
|
+
public setCookie(cookie: string) {
|
|
146
|
+
this.cookie = cookie;
|
|
147
|
+
}
|
|
144
148
|
}
|
|
145
149
|
|
|
146
150
|
/**
|