@heroku/heroku-fetch 0.1.4 → 0.1.6

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/dist/errors.d.ts CHANGED
@@ -1,5 +1,14 @@
1
1
  import type { HerokuErrorResponse } from './types.js';
2
2
  export declare class HerokuApiError extends Error {
3
+ /**
4
+ * The parsed JSON error body as the service returned it, when the response
5
+ * carried a JSON content-type. Unlike the promoted `id` / `errors` /
6
+ * `resource` fields, this preserves the whole body — including
7
+ * service-specific fields (e.g. a machine `reason` on an admin endpoint) that
8
+ * don't have a dedicated property. `undefined` when the body was absent or not
9
+ * JSON. Once read here, the streamed `response` body is consumed.
10
+ */
11
+ body?: HerokuErrorResponse;
3
12
  errors?: Array<{
4
13
  id: string;
5
14
  message: string;
package/dist/errors.js CHANGED
@@ -5,6 +5,7 @@ export class HerokuApiError extends Error {
5
5
  this.statusCode = statusCode;
6
6
  this.response = response;
7
7
  if (errorBody) {
8
+ this.body = errorBody;
8
9
  this.id = errorBody.id;
9
10
  this.errors = errorBody.errors;
10
11
  this.resource = errorBody.resource;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heroku/heroku-fetch",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "A JavaScript/TypeScript API client for Heroku APIs",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -23,15 +23,14 @@
23
23
  "dist"
24
24
  ],
25
25
  "scripts": {
26
- "build": "tsc",
27
- "test": "vitest run",
28
- "test:watch": "vitest",
29
- "test:coverage": "vitest run --coverage",
30
- "test:coverage:report": "vitest run --coverage --coverage.reporter=html --coverage.reporter=text",
26
+ "clean": "rimraf dist",
27
+ "build": "npm run clean && tsc",
31
28
  "lint": "eslint src",
32
29
  "lint:fix": "eslint src --fix",
33
- "prepare": "npm run build",
34
- "prepublishOnly": "npm run build"
30
+ "test": "vitest run",
31
+ "test:watch": "vitest",
32
+ "test:coverage": "vitest run --coverage --coverage.reporter=text-summary --coverage.reporter=lcovonly",
33
+ "prepare": "npm run build"
35
34
  },
36
35
  "keywords": [
37
36
  "heroku",
@@ -53,7 +52,7 @@
53
52
  "dependencies": {
54
53
  "debug": "^4.3.4",
55
54
  "ky": "^2.0.2",
56
- "undici": "^6.25.0"
55
+ "undici": "^8.11.2"
57
56
  },
58
57
  "optionalDependencies": {
59
58
  "@heroku/heroku-cli-util": "^10.8.0",
@@ -61,13 +60,14 @@
61
60
  "open": "^11.0.0"
62
61
  },
63
62
  "devDependencies": {
64
- "@heroku-cli/test-utils": "^0.2.0",
63
+ "@heroku-cli/test-utils": "^1.0.1",
65
64
  "@oclif/core": "^4.10.5",
66
65
  "@types/debug": "^4.1.12",
67
- "@types/node": "^20.11.19",
66
+ "@types/node": "^26.5.0",
68
67
  "@vitest/coverage-v8": "^4.1.6",
69
68
  "eslint": "^9.39.4",
70
69
  "eslint-config-oclif": "^6.0.152",
70
+ "rimraf": "^6.1.3",
71
71
  "tsx": "^4.7.1",
72
72
  "typescript": "^5.3.3",
73
73
  "vitest": "^4.1.6"