@nuxx/torn-fetch 0.3.1 → 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.
Files changed (4) hide show
  1. package/README.md +28 -12
  2. package/dist/index.d.ts +13484 -12984
  3. package/dist/index.js +1 -1
  4. package/package.json +14 -15
package/dist/index.js CHANGED
@@ -1 +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 useTornFetch};
1
+ import D from"openapi-fetch";var G=D({baseUrl:"https://api.torn.com/v2"});async function H(q,z,A){let j=await G.GET(z,{params:A,headers:{Authorization:`ApiKey ${q}`}});if(j.error)throw j.error;if(j.data!==void 0&&j.data!==null&&typeof j.data==="object"&&"error"in j.data&&typeof j.data.error==="object"&&j.data.error!==null&&"error"in j.data.error)throw Error(j.data.error.error);return j.data}async function J(q,z,A){return H(q,z,A)}var B=!1;async function N(q,z,A){if(!B)console.warn("[@nuxx/torn-fetch] useTornFetch is deprecated and will be removed in v2.0.0. Please use tornFetch instead."),B=!0;return J(q,z,A)}export{N as useTornFetch,J as tornFetch};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuxx/torn-fetch",
3
- "version": "0.3.1",
3
+ "version": "1.1.0",
4
4
  "packageManager": "bun@1.2.23",
5
5
  "description": "provides a wrapper around openapi-fetch that throws an error when Torn's API returns an error",
6
6
  "license": "Unlicense",
@@ -35,14 +35,14 @@
35
35
  "node": ">=18.0.0"
36
36
  },
37
37
  "scripts": {
38
- "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",
39
- "build": "tsup",
40
- "lint": "eslint",
38
+ "get-schema": "bun scripts/getSchema.ts",
39
+ "build": "bun ./build.ts",
40
+ "lint": "oxlint --type-aware",
41
+ "format": "oxfmt src/index.ts",
41
42
  "type-check": "tsc --noEmit",
42
- "test": "vitest run",
43
- "test:watch": "vitest",
44
- "test:coverage": "vitest run --coverage",
45
- "ci": "bun run get-schema && bun run lint && bun run type-check && bun run test && bun run build",
43
+ "test:watch": "bun test --watch",
44
+ "test:coverage": "bun test --coverage",
45
+ "ci": "bun run get-schema && bun run format && bun run lint && bun run type-check && bun test && bun run build",
46
46
  "prepublishOnly": "bun run ci",
47
47
  "prepack": "bun run build"
48
48
  },
@@ -50,16 +50,15 @@
50
50
  "openapi-fetch": "^0.14.1"
51
51
  },
52
52
  "devDependencies": {
53
- "@eslint/js": "^9.37.0",
54
- "@vitest/coverage-v8": "^2.1.0",
55
- "eslint": "^9.37.0",
53
+ "@types/bun": "^1.3.3",
54
+ "bun-plugin-dts": "^0.3.0",
56
55
  "globals": "^16.4.0",
57
56
  "openapi-typescript": "^7.9.1",
58
- "terser": "^5.44.0",
59
- "tsup": "^8.5.0",
57
+ "oxfmt": "^0.16.0",
58
+ "oxlint": "^1.31.0",
59
+ "oxlint-tsgolint": "^0.8.3",
60
60
  "typescript": "^5.9.3",
61
- "typescript-eslint": "^8.46.0",
62
- "vitest": "^2.1.9"
61
+ "typescript-eslint": "^8.46.0"
63
62
  },
64
63
  "exports": {
65
64
  ".": {