@scrapeatlas/cli 0.1.0 → 0.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.
- package/LICENSE +21 -0
- package/README.md +10 -5
- package/catalog.json +51706 -2443
- package/package.json +12 -8
- package/src/http.mjs +5 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scrapeatlas/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "Official ScrapeAtlas CLI — discover and call social data API endpoints from your terminal.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -10,17 +10,21 @@
|
|
|
10
10
|
"bin/",
|
|
11
11
|
"src/",
|
|
12
12
|
"catalog.json",
|
|
13
|
-
"README.md"
|
|
13
|
+
"README.md",
|
|
14
|
+
"LICENSE"
|
|
14
15
|
],
|
|
15
16
|
"engines": {
|
|
16
17
|
"node": ">=22"
|
|
17
18
|
},
|
|
18
|
-
"license": "
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
"
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
"license": "MIT",
|
|
20
|
+
"author": {
|
|
21
|
+
"name": "ScrapeAtlas",
|
|
22
|
+
"url": "https://scrapeatlas.com"
|
|
23
|
+
},
|
|
24
|
+
"homepage": "https://scrapeatlas.com/docs/cli/",
|
|
25
|
+
"bugs": {
|
|
26
|
+
"url": "https://scrapeatlas.com/contact/",
|
|
27
|
+
"email": "support@scrapeatlas.com"
|
|
24
28
|
},
|
|
25
29
|
"publishConfig": {
|
|
26
30
|
"access": "public",
|
package/src/http.mjs
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import { readFile } from 'node:fs/promises';
|
|
2
|
+
|
|
3
|
+
const { version } = JSON.parse(await readFile(new URL('../package.json', import.meta.url), 'utf8'));
|
|
4
|
+
|
|
1
5
|
export class CliError extends Error {
|
|
2
6
|
constructor(code, message, exitCode = 2) {
|
|
3
7
|
super(message);
|
|
@@ -50,7 +54,7 @@ export async function request(base, key, operation, input, timeout) {
|
|
|
50
54
|
headers: {
|
|
51
55
|
authorization: `Bearer ${key}`,
|
|
52
56
|
accept: 'application/json',
|
|
53
|
-
'user-agent':
|
|
57
|
+
'user-agent': `scrapeatlas-cli/${version}`,
|
|
54
58
|
...(operation.method === 'POST' ? { 'content-type': 'application/json' } : {}),
|
|
55
59
|
},
|
|
56
60
|
...(operation.method === 'POST' ? { body: JSON.stringify(input) } : {}),
|