@microlink/mql 0.14.0 → 0.14.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.
- package/lightweight/index.js +859 -230
- package/lightweight/index.umd.js +859 -230
- package/package.json +3 -2
- package/src/constants.js +13 -0
- package/src/node.js +11 -2
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@microlink/mql",
|
|
3
3
|
"description": "Microlink Query Language. The official HTTP client to interact with Microlink API for Node.js, browsers & Deno.",
|
|
4
4
|
"homepage": "https://microlink.io/mql",
|
|
5
|
-
"version": "0.14.
|
|
5
|
+
"version": "0.14.2",
|
|
6
6
|
"types": "lightweight/index.d.ts",
|
|
7
7
|
"exports": {
|
|
8
8
|
"require": "./src/node.js",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"flattie": "~1.1.1",
|
|
50
50
|
"got": "~11.8.6",
|
|
51
|
-
"whoops": "~5.0
|
|
51
|
+
"whoops": "~5.1.0"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@commitlint/cli": "latest",
|
|
@@ -83,6 +83,7 @@
|
|
|
83
83
|
},
|
|
84
84
|
"files": [
|
|
85
85
|
"lightweight",
|
|
86
|
+
"src/constants.js",
|
|
86
87
|
"src/factory.js",
|
|
87
88
|
"src/node.js"
|
|
88
89
|
],
|
package/src/constants.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const VERSION = require('../package.json').version
|
|
4
|
+
|
|
5
|
+
module.exports = {
|
|
6
|
+
VERSION,
|
|
7
|
+
USER_AGENT: `mql/${VERSION}`,
|
|
8
|
+
/**
|
|
9
|
+
* Based on require('got').defaults.options.retry.statusCodes
|
|
10
|
+
* but without 429 (too many requests)
|
|
11
|
+
*/
|
|
12
|
+
RETRY_STATUS_CODES: [408, 413, 500, 502, 503, 504, 521, 522, 524]
|
|
13
|
+
}
|
package/src/node.js
CHANGED
|
@@ -1,8 +1,17 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const got = require('got')
|
|
4
|
+
|
|
5
|
+
const { VERSION, USER_AGENT, RETRY_STATUS_CODES } = require('./constants')
|
|
6
|
+
|
|
1
7
|
const mql = require('./factory')('buffer')({
|
|
2
8
|
MicrolinkError: require('whoops')('MicrolinkError'),
|
|
3
|
-
got:
|
|
9
|
+
got: got.extend({
|
|
10
|
+
headers: { 'user-agent': USER_AGENT },
|
|
11
|
+
retry: { statusCodes: RETRY_STATUS_CODES }
|
|
12
|
+
}),
|
|
4
13
|
flatten: require('flattie').flattie,
|
|
5
|
-
VERSION
|
|
14
|
+
VERSION
|
|
6
15
|
})
|
|
7
16
|
|
|
8
17
|
module.exports = mql
|