@gr4vy/sdk 1.10.3 → 1.10.4
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/README.md +11 -7
- package/examples/package-lock.json +1 -1
- package/jsr.json +1 -1
- package/lib/config.d.ts +3 -3
- package/lib/config.js +3 -3
- package/package.json +1 -1
- package/src/lib/config.ts +3 -3
package/README.md
CHANGED
|
@@ -638,19 +638,23 @@ The `HTTPClient` constructor takes an optional `fetcher` argument that can be
|
|
|
638
638
|
used to integrate a third-party HTTP client or when writing tests to mock out
|
|
639
639
|
the HTTP client and feed in fixtures.
|
|
640
640
|
|
|
641
|
-
The following example shows how to
|
|
642
|
-
|
|
643
|
-
to
|
|
641
|
+
The following example shows how to:
|
|
642
|
+
- route requests through a proxy server using [undici](https://www.npmjs.com/package/undici)'s ProxyAgent
|
|
643
|
+
- use the `"beforeRequest"` hook to add a custom header and a timeout to requests
|
|
644
|
+
- use the `"requestError"` hook to log errors
|
|
644
645
|
|
|
645
646
|
```typescript
|
|
646
647
|
import { Gr4vy } from "@gr4vy/sdk";
|
|
648
|
+
import { ProxyAgent } from "undici";
|
|
647
649
|
import { HTTPClient } from "@gr4vy/sdk/lib/http";
|
|
648
650
|
|
|
651
|
+
const dispatcher = new ProxyAgent("http://proxy.example.com:8080");
|
|
652
|
+
|
|
649
653
|
const httpClient = new HTTPClient({
|
|
650
|
-
// fetcher takes a function that has the same signature as native
|
|
651
|
-
fetcher: (
|
|
652
|
-
|
|
653
|
-
|
|
654
|
+
// 'fetcher' takes a function that has the same signature as native 'fetch'.
|
|
655
|
+
fetcher: (input, init) =>
|
|
656
|
+
// 'dispatcher' is specific to undici and not part of the standard Fetch API.
|
|
657
|
+
fetch(input, { ...init, dispatcher } as RequestInit),
|
|
654
658
|
});
|
|
655
659
|
|
|
656
660
|
httpClient.addHook("beforeRequest", (request) => {
|
package/jsr.json
CHANGED
package/lib/config.d.ts
CHANGED
|
@@ -44,8 +44,8 @@ export declare function serverURLFromOptions(options: SDKOptions): URL | null;
|
|
|
44
44
|
export declare const SDK_METADATA: {
|
|
45
45
|
readonly language: "typescript";
|
|
46
46
|
readonly openapiDocVersion: "1.0.0";
|
|
47
|
-
readonly sdkVersion: "1.10.
|
|
48
|
-
readonly genVersion: "2.
|
|
49
|
-
readonly userAgent: "speakeasy-sdk/typescript 1.10.
|
|
47
|
+
readonly sdkVersion: "1.10.4";
|
|
48
|
+
readonly genVersion: "2.818.4";
|
|
49
|
+
readonly userAgent: "speakeasy-sdk/typescript 1.10.4 2.818.4 1.0.0 @gr4vy/sdk";
|
|
50
50
|
};
|
|
51
51
|
//# sourceMappingURL=config.d.ts.map
|
package/lib/config.js
CHANGED
|
@@ -37,8 +37,8 @@ function serverURLFromOptions(options) {
|
|
|
37
37
|
exports.SDK_METADATA = {
|
|
38
38
|
language: "typescript",
|
|
39
39
|
openapiDocVersion: "1.0.0",
|
|
40
|
-
sdkVersion: "1.10.
|
|
41
|
-
genVersion: "2.
|
|
42
|
-
userAgent: "speakeasy-sdk/typescript 1.10.
|
|
40
|
+
sdkVersion: "1.10.4",
|
|
41
|
+
genVersion: "2.818.4",
|
|
42
|
+
userAgent: "speakeasy-sdk/typescript 1.10.4 2.818.4 1.0.0 @gr4vy/sdk",
|
|
43
43
|
};
|
|
44
44
|
//# sourceMappingURL=config.js.map
|
package/package.json
CHANGED
package/src/lib/config.ts
CHANGED
|
@@ -77,7 +77,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
|
|
|
77
77
|
export const SDK_METADATA = {
|
|
78
78
|
language: "typescript",
|
|
79
79
|
openapiDocVersion: "1.0.0",
|
|
80
|
-
sdkVersion: "1.10.
|
|
81
|
-
genVersion: "2.
|
|
82
|
-
userAgent: "speakeasy-sdk/typescript 1.10.
|
|
80
|
+
sdkVersion: "1.10.4",
|
|
81
|
+
genVersion: "2.818.4",
|
|
82
|
+
userAgent: "speakeasy-sdk/typescript 1.10.4 2.818.4 1.0.0 @gr4vy/sdk",
|
|
83
83
|
} as const;
|