@heroku/heroku-fetch 0.1.3 → 0.1.5
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/client/index.js +4 -1
- package/dist/errors.d.ts +9 -0
- package/dist/errors.js +1 -0
- package/dist/types.d.ts +9 -0
- package/package.json +2 -2
package/dist/client/index.js
CHANGED
|
@@ -45,7 +45,10 @@ export class HerokuApiClient {
|
|
|
45
45
|
createAfterResponseHook(this.options.twoFactor, this.twoFactorAttempted),
|
|
46
46
|
],
|
|
47
47
|
beforeRequest: [
|
|
48
|
-
createBeforeRequestHook(() => this.getToken(),
|
|
48
|
+
createBeforeRequestHook(() => this.getToken(),
|
|
49
|
+
// A per-client override wins over the shared service default, but
|
|
50
|
+
// is still only applied when the request has no Accept of its own.
|
|
51
|
+
options.defaultAccept ?? serviceConfig.defaultAccept, options.headers, this.options.debug),
|
|
49
52
|
],
|
|
50
53
|
},
|
|
51
54
|
prefix: baseUrl,
|
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
package/dist/types.d.ts
CHANGED
|
@@ -23,6 +23,15 @@ export interface HerokuApiClientOptions {
|
|
|
23
23
|
baseUrl?: string;
|
|
24
24
|
/** Enable debugging */
|
|
25
25
|
debug?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Override the service's default `Accept` header for this client. Applied
|
|
28
|
+
* only when a request doesn't already carry an `Accept` (so per-call
|
|
29
|
+
* `withHeaders({Accept})` still wins); falls back to the service config's
|
|
30
|
+
* default when unset. Lets a consumer whose types/routes are generated from
|
|
31
|
+
* a specific API variant (e.g. `@heroku/sdk`, generated from `version=3.sdk`)
|
|
32
|
+
* dispatch at that variant without changing the shared service default.
|
|
33
|
+
*/
|
|
34
|
+
defaultAccept?: string;
|
|
26
35
|
/** Additional custom headers */
|
|
27
36
|
headers?: Record<string, string>;
|
|
28
37
|
/** Service region (e.g., 'eu', 'us') */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@heroku/heroku-fetch",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "A JavaScript/TypeScript API client for Heroku APIs",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"open": "^11.0.0"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
|
-
"@heroku-cli/test-utils": "^0.
|
|
64
|
+
"@heroku-cli/test-utils": "^1.0.1",
|
|
65
65
|
"@oclif/core": "^4.10.5",
|
|
66
66
|
"@types/debug": "^4.1.12",
|
|
67
67
|
"@types/node": "^20.11.19",
|