aragog-client 1.0.2 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/lib/management.js +0 -1
- package/lib/types.d.ts +2 -1
- package/lib/utils.js +9 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Aragog Client
|
|
2
2
|
|
|
3
|
-
[](https://travis-ci.com/crawlerlab/aragog)
|
|
3
|
+
[](https://app.travis-ci.com/github/crawlerlab/aragog)
|
|
4
4
|
[](https://www.npmjs.com/package/aragog-client)
|
|
5
5
|
[](https://github.com/crawlerlab/aragog/blob/master/LICENSE)
|
|
6
6
|
|
package/lib/management.js
CHANGED
|
@@ -5,7 +5,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.createManagementApi = void 0;
|
|
7
7
|
const axios_1 = __importDefault(require("axios"));
|
|
8
|
-
/* eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types */
|
|
9
8
|
const createManagementApi = (conn, { ssl = false }) => {
|
|
10
9
|
const request = axios_1.default.create({
|
|
11
10
|
baseURL: `${ssl ? 'https' : 'http'}://${conn.hostname}:${conn.port || 15672}/api/`,
|
package/lib/types.d.ts
CHANGED
package/lib/utils.js
CHANGED
|
@@ -2,10 +2,17 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.checkConnectParam = exports.checkTaskInput = void 0;
|
|
4
4
|
const checkTaskInput = (data) => {
|
|
5
|
+
if (!data.readable) {
|
|
6
|
+
if (!data.script) {
|
|
7
|
+
throw new Error('script is required');
|
|
8
|
+
}
|
|
9
|
+
if (typeof data.script !== 'string') {
|
|
10
|
+
throw new Error('script must be of type string');
|
|
11
|
+
}
|
|
12
|
+
}
|
|
5
13
|
const allKeys = [
|
|
6
14
|
'id',
|
|
7
15
|
'url',
|
|
8
|
-
'script',
|
|
9
16
|
'disableImage',
|
|
10
17
|
'encoding',
|
|
11
18
|
'method',
|
|
@@ -19,7 +26,7 @@ const checkTaskInput = (data) => {
|
|
|
19
26
|
];
|
|
20
27
|
allKeys.forEach((key) => {
|
|
21
28
|
var _a, _b;
|
|
22
|
-
if (['id', 'url'
|
|
29
|
+
if (['id', 'url'].includes(key)) {
|
|
23
30
|
if (!data[key]) {
|
|
24
31
|
throw new Error(`${key} is required`);
|
|
25
32
|
}
|
|
@@ -75,7 +82,6 @@ const checkTaskInput = (data) => {
|
|
|
75
82
|
}
|
|
76
83
|
Object.entries(fieldTypes).forEach(([k, type]) => {
|
|
77
84
|
const cookieKey = k;
|
|
78
|
-
/* eslint-disable-next-line valid-typeof */
|
|
79
85
|
if (cookie[cookieKey] !== undefined && typeof cookie[cookieKey] !== type) {
|
|
80
86
|
throw new Error(`cookies.${k} must be of type ${type}`);
|
|
81
87
|
}
|