@nuxx/torn-fetch 0.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/COPYING +24 -0
- package/README.md +190 -0
- package/dist/index.d.ts +10636 -0
- package/dist/index.js +1 -0
- package/nuxx-torn-fetch-0.1.0.tgz +0 -0
- package/package.json +54 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import a from"openapi-fetch";var r=a({baseUrl:"https://api.torn.com/v2"});async function t(a,t,o){return await async function(a,t,o){const e={params:o,headers:{Authorization:`ApiKey ${a}`}},n=await r.GET(t,e);if(void 0!==n.data&&null!==n.data&&"object"==typeof n.data&&"error"in n.data)throw new Error(n.data.error.error);return n.data}(a,t,o)}export{t as tornFetch};
|
|
Binary file
|
package/package.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nuxx/torn-fetch",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"packageManager": "pnpm@10.13.1",
|
|
5
|
+
"description": "provides a wrapper around openapi-fetch that throws an error when Torn's API returns an error",
|
|
6
|
+
"license": "Unlicense",
|
|
7
|
+
"author": "nuxx [3054747]",
|
|
8
|
+
"type": "module",
|
|
9
|
+
"source": "src/index.ts",
|
|
10
|
+
"main": "dist/index.js",
|
|
11
|
+
"types": "dist/index.d.ts",
|
|
12
|
+
"keywords": [
|
|
13
|
+
"torn",
|
|
14
|
+
"api",
|
|
15
|
+
"fetch",
|
|
16
|
+
"typescript",
|
|
17
|
+
"openapi"
|
|
18
|
+
],
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "https://github.com/nuxx-3054747/torn-fetch.git"
|
|
22
|
+
},
|
|
23
|
+
"scripts": {
|
|
24
|
+
"get-schema": "curl -A 'nuxx-torn-fetch' https://www.torn.com/swagger/openapi.json > ./src/openapi.json && openapi-typescript ./src/openapi.json -o ./src/torn-api.ts",
|
|
25
|
+
"build": "tsup",
|
|
26
|
+
"lint": "eslint",
|
|
27
|
+
"type-check": "tsc --noEmit",
|
|
28
|
+
"test": "vitest run",
|
|
29
|
+
"test:watch": "vitest",
|
|
30
|
+
"test:coverage": "vitest run --coverage",
|
|
31
|
+
"ci": "pnpm get-schema && pnpm lint && pnpm type-check && pnpm test && pnpm build"
|
|
32
|
+
},
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"openapi-fetch": "^0.14.0"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@eslint/js": "^9.31.0",
|
|
38
|
+
"@vitest/coverage-v8": "^2.1.0",
|
|
39
|
+
"eslint": "^9.31.0",
|
|
40
|
+
"globals": "^16.3.0",
|
|
41
|
+
"openapi-typescript": "^7.8.0",
|
|
42
|
+
"terser": "^5.43.1",
|
|
43
|
+
"tsup": "^8.5.0",
|
|
44
|
+
"typescript": "^5.8.3",
|
|
45
|
+
"typescript-eslint": "^8.37.0",
|
|
46
|
+
"vitest": "^2.1.0"
|
|
47
|
+
},
|
|
48
|
+
"exports": {
|
|
49
|
+
".": {
|
|
50
|
+
"types": "./dist/index.d.ts",
|
|
51
|
+
"import": "./dist/index.js"
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|