@microlink/mql 0.13.11 → 0.13.13
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.d.ts +167 -135
- package/lightweight/index.js +1 -1
- package/lightweight/index.umd.js +1 -1
- package/package.json +2 -2
package/lightweight/index.d.ts
CHANGED
|
@@ -1,194 +1,226 @@
|
|
|
1
|
-
type ColorScheme =
|
|
1
|
+
type ColorScheme = 'dark' | 'light'
|
|
2
2
|
|
|
3
|
-
type WaitUntilEvent =
|
|
3
|
+
type WaitUntilEvent =
|
|
4
|
+
| 'load'
|
|
5
|
+
| 'domcontentloaded'
|
|
6
|
+
| 'networkidle0'
|
|
7
|
+
| 'networkidle2'
|
|
4
8
|
|
|
5
|
-
type PixelUnit = string | number
|
|
9
|
+
type PixelUnit = string | number
|
|
6
10
|
|
|
7
11
|
type ScreenshotOverlay = {
|
|
8
|
-
background?: string
|
|
12
|
+
background?: string
|
|
9
13
|
browser?: 'dark' | 'light'
|
|
10
14
|
}
|
|
11
15
|
|
|
12
16
|
type PdfMargin = {
|
|
13
|
-
bottom?: string | number
|
|
14
|
-
left?: string | number
|
|
15
|
-
right?: string | number
|
|
16
|
-
top?: string | number
|
|
17
|
+
bottom?: string | number
|
|
18
|
+
left?: string | number
|
|
19
|
+
right?: string | number
|
|
20
|
+
top?: string | number
|
|
17
21
|
}
|
|
18
22
|
|
|
19
23
|
type PdfOptions = {
|
|
20
|
-
format?: string
|
|
21
|
-
height?: PixelUnit
|
|
22
|
-
landscape?: string
|
|
23
|
-
margin?: string | PdfMargin
|
|
24
|
-
pageRanges?: string
|
|
25
|
-
scale?: number
|
|
26
|
-
width?: PixelUnit
|
|
24
|
+
format?: string
|
|
25
|
+
height?: PixelUnit
|
|
26
|
+
landscape?: string
|
|
27
|
+
margin?: string | PdfMargin
|
|
28
|
+
pageRanges?: string
|
|
29
|
+
scale?: number
|
|
30
|
+
width?: PixelUnit
|
|
27
31
|
}
|
|
28
32
|
|
|
29
33
|
type ScreenshotOptions = {
|
|
30
|
-
codeScheme?: string
|
|
31
|
-
element?: string
|
|
32
|
-
fullPage?: boolean
|
|
33
|
-
omitBackground?: boolean
|
|
34
|
-
optimizeForSpeed?: boolean
|
|
35
|
-
overlay?: ScreenshotOverlay
|
|
36
|
-
type?:
|
|
34
|
+
codeScheme?: string
|
|
35
|
+
element?: string
|
|
36
|
+
fullPage?: boolean
|
|
37
|
+
omitBackground?: boolean
|
|
38
|
+
optimizeForSpeed?: boolean
|
|
39
|
+
overlay?: ScreenshotOverlay
|
|
40
|
+
type?: 'jpeg' | 'png'
|
|
37
41
|
}
|
|
38
42
|
|
|
39
43
|
type MqlClientOptions = {
|
|
40
|
-
apiKey?: string
|
|
41
|
-
cache?: Map<string, any
|
|
42
|
-
endpoint?: string
|
|
43
|
-
retry?: number
|
|
44
|
+
apiKey?: string
|
|
45
|
+
cache?: Map<string, any>
|
|
46
|
+
endpoint?: string
|
|
47
|
+
retry?: number
|
|
44
48
|
}
|
|
45
49
|
|
|
46
50
|
type MqlQuery = {
|
|
47
|
-
[field: string]: MqlQueryOptions
|
|
51
|
+
[field: string]: MqlQueryOptions
|
|
48
52
|
}
|
|
49
53
|
|
|
50
54
|
type MqlQueryOptions = {
|
|
51
|
-
attr?: string | string[] | MqlQuery
|
|
52
|
-
evaluate?: string
|
|
53
|
-
selector?: string | string[]
|
|
54
|
-
selectorAll?: string | string[]
|
|
55
|
-
type?:
|
|
55
|
+
attr?: string | string[] | MqlQuery
|
|
56
|
+
evaluate?: string
|
|
57
|
+
selector?: string | string[]
|
|
58
|
+
selectorAll?: string | string[]
|
|
59
|
+
type?:
|
|
60
|
+
| 'audio'
|
|
61
|
+
| 'author'
|
|
62
|
+
| 'auto'
|
|
63
|
+
| 'boolean'
|
|
64
|
+
| 'date'
|
|
65
|
+
| 'description'
|
|
66
|
+
| 'email'
|
|
67
|
+
| 'image'
|
|
68
|
+
| 'ip'
|
|
69
|
+
| 'lang'
|
|
70
|
+
| 'logo'
|
|
71
|
+
| 'number'
|
|
72
|
+
| 'object'
|
|
73
|
+
| 'publisher'
|
|
74
|
+
| 'regexp'
|
|
75
|
+
| 'string'
|
|
76
|
+
| 'title'
|
|
77
|
+
| 'url'
|
|
78
|
+
| 'video'
|
|
56
79
|
}
|
|
57
80
|
|
|
58
81
|
type MicrolinkApiOptions = {
|
|
59
|
-
adblock?: boolean
|
|
60
|
-
animations?: boolean
|
|
61
|
-
audio?: boolean
|
|
62
|
-
click?: string | string[]
|
|
63
|
-
colorScheme?: ColorScheme
|
|
64
|
-
data?: MqlQuery
|
|
65
|
-
device?: string
|
|
66
|
-
embed?: string
|
|
67
|
-
filename?: string
|
|
68
|
-
filter?: string
|
|
69
|
-
force?: boolean
|
|
70
|
-
function?: string
|
|
71
|
-
headers?: Record<string, string
|
|
72
|
-
iframe?: boolean | { maxWidth?: number
|
|
73
|
-
insights?: boolean | { lighthouse?: boolean | object
|
|
74
|
-
javascript?: boolean
|
|
75
|
-
mediaType?: string
|
|
76
|
-
meta?: boolean | { logo: { square: boolean } }
|
|
77
|
-
modules?: string | string[]
|
|
78
|
-
palette?: boolean
|
|
79
|
-
pdf?: boolean | PdfOptions
|
|
80
|
-
ping?: boolean | object
|
|
81
|
-
prerender?: boolean |
|
|
82
|
-
proxy?: string | { countryCode?: string }
|
|
83
|
-
retry?: number
|
|
84
|
-
screenshot?: boolean | ScreenshotOptions
|
|
85
|
-
scripts?: string | string[]
|
|
86
|
-
scroll?: string
|
|
87
|
-
staleTtl?: string | number
|
|
88
|
-
stream?: string
|
|
89
|
-
styles?: string | string[]
|
|
90
|
-
timeout?: number
|
|
91
|
-
ttl?: string | number
|
|
92
|
-
video?: boolean
|
|
93
|
-
viewport?: object
|
|
94
|
-
waitForSelector?: string
|
|
95
|
-
waitForTimeout?: number
|
|
96
|
-
waitUntil?: WaitUntilEvent | WaitUntilEvent[]
|
|
82
|
+
adblock?: boolean
|
|
83
|
+
animations?: boolean
|
|
84
|
+
audio?: boolean
|
|
85
|
+
click?: string | string[]
|
|
86
|
+
colorScheme?: ColorScheme
|
|
87
|
+
data?: MqlQuery
|
|
88
|
+
device?: string
|
|
89
|
+
embed?: string
|
|
90
|
+
filename?: string
|
|
91
|
+
filter?: string
|
|
92
|
+
force?: boolean
|
|
93
|
+
function?: string
|
|
94
|
+
headers?: Record<string, string>
|
|
95
|
+
iframe?: boolean | { maxWidth?: number; maxHeight?: number }
|
|
96
|
+
insights?: boolean | { lighthouse?: boolean | object; technologies?: boolean }
|
|
97
|
+
javascript?: boolean
|
|
98
|
+
mediaType?: string
|
|
99
|
+
meta?: boolean | { logo: { square: boolean } }
|
|
100
|
+
modules?: string | string[]
|
|
101
|
+
palette?: boolean
|
|
102
|
+
pdf?: boolean | PdfOptions
|
|
103
|
+
ping?: boolean | object
|
|
104
|
+
prerender?: boolean | 'auto'
|
|
105
|
+
proxy?: string | { countryCode?: string }
|
|
106
|
+
retry?: number
|
|
107
|
+
screenshot?: boolean | ScreenshotOptions
|
|
108
|
+
scripts?: string | string[]
|
|
109
|
+
scroll?: string
|
|
110
|
+
staleTtl?: string | number
|
|
111
|
+
stream?: string
|
|
112
|
+
styles?: string | string[]
|
|
113
|
+
timeout?: number
|
|
114
|
+
ttl?: string | number
|
|
115
|
+
video?: boolean
|
|
116
|
+
viewport?: object
|
|
117
|
+
waitForSelector?: string
|
|
118
|
+
waitForTimeout?: number
|
|
119
|
+
waitUntil?: WaitUntilEvent | WaitUntilEvent[]
|
|
97
120
|
}
|
|
98
121
|
|
|
99
122
|
type IframeInfo = {
|
|
100
|
-
html: string
|
|
101
|
-
scripts: Record<string, unknown
|
|
123
|
+
html: string
|
|
124
|
+
scripts: Record<string, unknown>
|
|
102
125
|
}
|
|
103
126
|
|
|
104
127
|
type MediaInfo = {
|
|
105
|
-
alternative_color?: string
|
|
106
|
-
background_color?: string
|
|
107
|
-
color?: string
|
|
108
|
-
duration_pretty?: string
|
|
109
|
-
duration?: number
|
|
110
|
-
height?: number
|
|
111
|
-
palette?: string[]
|
|
112
|
-
size_pretty?: string
|
|
113
|
-
size?: number
|
|
114
|
-
type?: string
|
|
115
|
-
url: string
|
|
116
|
-
width?: number
|
|
128
|
+
alternative_color?: string
|
|
129
|
+
background_color?: string
|
|
130
|
+
color?: string
|
|
131
|
+
duration_pretty?: string
|
|
132
|
+
duration?: number
|
|
133
|
+
height?: number
|
|
134
|
+
palette?: string[]
|
|
135
|
+
size_pretty?: string
|
|
136
|
+
size?: number
|
|
137
|
+
type?: string
|
|
138
|
+
url: string
|
|
139
|
+
width?: number
|
|
117
140
|
}
|
|
118
141
|
|
|
119
142
|
export type MqlResponseData = {
|
|
120
|
-
audio?: MediaInfo | null
|
|
121
|
-
author?: string | null
|
|
122
|
-
date?: string | null
|
|
123
|
-
description?: string | null
|
|
124
|
-
function?: MqlFunctionResult
|
|
125
|
-
iframe?: IframeInfo | null
|
|
126
|
-
image?: MediaInfo | null
|
|
127
|
-
lang?: string | null
|
|
128
|
-
logo?: MediaInfo | null
|
|
129
|
-
publisher?: string | null
|
|
130
|
-
screenshot?: MediaInfo | null
|
|
131
|
-
title?: string | null
|
|
132
|
-
url?: string
|
|
133
|
-
video?: MediaInfo | null
|
|
143
|
+
audio?: MediaInfo | null
|
|
144
|
+
author?: string | null
|
|
145
|
+
date?: string | null
|
|
146
|
+
description?: string | null
|
|
147
|
+
function?: MqlFunctionResult
|
|
148
|
+
iframe?: IframeInfo | null
|
|
149
|
+
image?: MediaInfo | null
|
|
150
|
+
lang?: string | null
|
|
151
|
+
logo?: MediaInfo | null
|
|
152
|
+
publisher?: string | null
|
|
153
|
+
screenshot?: MediaInfo | null
|
|
154
|
+
title?: string | null
|
|
155
|
+
url?: string
|
|
156
|
+
video?: MediaInfo | null
|
|
134
157
|
}
|
|
135
158
|
|
|
136
159
|
type MqlFunctionResult = {
|
|
137
|
-
isFulfilled: boolean
|
|
138
|
-
isRejected: boolean
|
|
139
|
-
value: any
|
|
140
|
-
}
|
|
160
|
+
isFulfilled: boolean
|
|
161
|
+
isRejected: boolean
|
|
162
|
+
value: any
|
|
163
|
+
}
|
|
141
164
|
|
|
142
|
-
type MqlStatus =
|
|
165
|
+
type MqlStatus = 'success' | 'fail' | 'error'
|
|
143
166
|
|
|
144
167
|
export type MqlPayload = {
|
|
145
|
-
status: MqlStatus
|
|
146
|
-
data: MqlResponseData
|
|
147
|
-
statusCode?: number
|
|
148
|
-
|
|
168
|
+
status: MqlStatus
|
|
169
|
+
data: MqlResponseData
|
|
170
|
+
statusCode?: number
|
|
171
|
+
redirects: { statusCode: number; url: string }[]
|
|
172
|
+
headers: { [key: string]: string }
|
|
149
173
|
}
|
|
150
174
|
|
|
151
175
|
type HTTPResponse = {
|
|
152
|
-
url: string
|
|
153
|
-
statusCode: number
|
|
154
|
-
headers: Headers
|
|
176
|
+
url: string
|
|
177
|
+
statusCode: number
|
|
178
|
+
headers: Headers
|
|
155
179
|
}
|
|
156
180
|
|
|
157
|
-
type HTTPResponseWithBody = HTTPResponse & { body: MqlPayload }
|
|
181
|
+
type HTTPResponseWithBody = HTTPResponse & { body: MqlPayload }
|
|
158
182
|
|
|
159
|
-
export type HTTPResponseRaw = HTTPResponse & { body: ArrayBuffer }
|
|
183
|
+
export type HTTPResponseRaw = HTTPResponse & { body: ArrayBuffer }
|
|
160
184
|
|
|
161
|
-
export type MqlResponse = MqlPayload & { response: HTTPResponseWithBody }
|
|
185
|
+
export type MqlResponse = MqlPayload & { response: HTTPResponseWithBody }
|
|
162
186
|
|
|
163
187
|
export type MqlError = {
|
|
164
|
-
code: string
|
|
165
|
-
data?: MqlResponseData
|
|
166
|
-
description: string
|
|
167
|
-
headers: { [key: string]: string }
|
|
168
|
-
message: string
|
|
169
|
-
more: string
|
|
170
|
-
name: string
|
|
171
|
-
status: MqlStatus
|
|
172
|
-
statusCode?: number
|
|
173
|
-
url: string
|
|
188
|
+
code: string
|
|
189
|
+
data?: MqlResponseData
|
|
190
|
+
description: string
|
|
191
|
+
headers: { [key: string]: string }
|
|
192
|
+
message: string
|
|
193
|
+
more: string
|
|
194
|
+
name: string
|
|
195
|
+
status: MqlStatus
|
|
196
|
+
statusCode?: number
|
|
197
|
+
url: string
|
|
174
198
|
}
|
|
175
199
|
|
|
176
|
-
export type MqlOptions = MqlClientOptions & MicrolinkApiOptions
|
|
200
|
+
export type MqlOptions = MqlClientOptions & MicrolinkApiOptions
|
|
177
201
|
|
|
178
|
-
export const MicrolinkError: new (props: object) => MqlError
|
|
202
|
+
export const MicrolinkError: new (props: object) => MqlError
|
|
179
203
|
|
|
180
|
-
export const version: string
|
|
204
|
+
export const version: string
|
|
181
205
|
|
|
182
206
|
interface mql {
|
|
183
|
-
(
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
207
|
+
(
|
|
208
|
+
url: string,
|
|
209
|
+
opts?: MqlOptions & { stream: string },
|
|
210
|
+
gotOpts?: object
|
|
211
|
+
): Promise<HTTPResponseRaw>
|
|
212
|
+
(url: string, opts?: MqlOptions, gotOpts?: object): Promise<MqlResponse>
|
|
213
|
+
arrayBuffer: (
|
|
214
|
+
url: string,
|
|
215
|
+
opts?: MqlOptions,
|
|
216
|
+
gotOpts?: object
|
|
217
|
+
) => Promise<HTTPResponseRaw>
|
|
218
|
+
extend: (gotOpts?: object) => mql
|
|
219
|
+
stream: (input: RequestInfo, init?: RequestInit) => ReadableStream
|
|
220
|
+
MicrolinkError: new (props: object) => MqlError
|
|
221
|
+
version: string
|
|
190
222
|
}
|
|
191
223
|
|
|
192
|
-
declare const mql: mql
|
|
224
|
+
declare const mql: mql
|
|
193
225
|
|
|
194
|
-
export default mql
|
|
226
|
+
export default mql
|
package/lightweight/index.js
CHANGED
package/lightweight/index.umd.js
CHANGED
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.13.
|
|
5
|
+
"version": "0.13.13",
|
|
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": "~
|
|
51
|
+
"whoops": "~5.0.0"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@commitlint/cli": "latest",
|