@output.ai/http 0.1.2 → 0.2.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/dist/config.d.ts +1 -1
- package/dist/config.js +2 -2
- package/dist/hooks/trace_error.d.ts +1 -1
- package/dist/hooks/trace_error.js +1 -1
- package/dist/hooks/trace_request.d.ts +2 -2
- package/dist/hooks/trace_request.js +2 -2
- package/dist/hooks/trace_response.d.ts +2 -2
- package/dist/hooks/trace_response.js +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/package.json +1 -1
package/dist/config.d.ts
CHANGED
package/dist/config.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
export const config = {
|
|
5
5
|
/**
|
|
6
6
|
* Whether to log verbose HTTP information (headers and bodies)
|
|
7
|
-
* Controlled by
|
|
7
|
+
* Controlled by OUTPUT_TRACE_HTTP_VERBOSE environment variable
|
|
8
8
|
*/
|
|
9
|
-
logVerbose: ['1', 'true'].includes(process.env.
|
|
9
|
+
logVerbose: ['1', 'true'].includes(process.env.OUTPUT_TRACE_HTTP_VERBOSE)
|
|
10
10
|
};
|
|
@@ -9,6 +9,6 @@ import type { BeforeErrorHook, Input } from 'ky';
|
|
|
9
9
|
*/
|
|
10
10
|
export declare function applyFetchErrorTracing(fetchFn: (input: Input, init?: RequestInit) => Promise<Response>): (input: Input, init?: RequestInit) => Promise<Response>;
|
|
11
11
|
/**
|
|
12
|
-
* Traces HTTP errors for observability using Output
|
|
12
|
+
* Traces HTTP errors for observability using Output.ai tracing
|
|
13
13
|
*/
|
|
14
14
|
export declare const traceError: BeforeErrorHook;
|
|
@@ -39,7 +39,7 @@ export function applyFetchErrorTracing(fetchFn) {
|
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
41
|
/**
|
|
42
|
-
* Traces HTTP errors for observability using Output
|
|
42
|
+
* Traces HTTP errors for observability using Output.ai tracing
|
|
43
43
|
*/
|
|
44
44
|
export const traceError = (error) => {
|
|
45
45
|
const traceId = createTraceId(error.request);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { BeforeRequestHook } from 'ky';
|
|
2
2
|
/**
|
|
3
|
-
* Traces HTTP request for observability using Output
|
|
4
|
-
* Respects
|
|
3
|
+
* Traces HTTP request for observability using Output.ai tracing
|
|
4
|
+
* Respects OUTPUT_TRACE_HTTP_VERBOSE environment variable for detailed logging
|
|
5
5
|
*/
|
|
6
6
|
export declare const traceRequest: BeforeRequestHook;
|
|
@@ -2,8 +2,8 @@ import { Tracing } from '@output.ai/core/tracing';
|
|
|
2
2
|
import { redactHeaders, createTraceId, parseRequestBody } from '#utils/index.js';
|
|
3
3
|
import { config } from '#config.js';
|
|
4
4
|
/**
|
|
5
|
-
* Traces HTTP request for observability using Output
|
|
6
|
-
* Respects
|
|
5
|
+
* Traces HTTP request for observability using Output.ai tracing
|
|
6
|
+
* Respects OUTPUT_TRACE_HTTP_VERBOSE environment variable for detailed logging
|
|
7
7
|
*/
|
|
8
8
|
export const traceRequest = async (request, _options) => {
|
|
9
9
|
const traceId = createTraceId(request);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AfterResponseHook } from 'ky';
|
|
2
2
|
/**
|
|
3
|
-
* Traces HTTP response for observability using Output
|
|
4
|
-
* Respects
|
|
3
|
+
* Traces HTTP response for observability using Output.ai tracing
|
|
4
|
+
* Respects OUTPUT_TRACE_HTTP_VERBOSE environment variable for detailed logging
|
|
5
5
|
*/
|
|
6
6
|
export declare const traceResponse: AfterResponseHook;
|
|
@@ -2,8 +2,8 @@ import { Tracing } from '@output.ai/core/tracing';
|
|
|
2
2
|
import { redactHeaders, createTraceId, parseResponseBody } from '#utils/index.js';
|
|
3
3
|
import { config } from '#config.js';
|
|
4
4
|
/**
|
|
5
|
-
* Traces HTTP response for observability using Output
|
|
6
|
-
* Respects
|
|
5
|
+
* Traces HTTP response for observability using Output.ai tracing
|
|
6
|
+
* Respects OUTPUT_TRACE_HTTP_VERBOSE environment variable for detailed logging
|
|
7
7
|
*/
|
|
8
8
|
export const traceResponse = async (request, _options, response) => {
|
|
9
9
|
const traceId = createTraceId(request);
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { Options } from 'ky';
|
|
|
2
2
|
/**
|
|
3
3
|
* Creates a ky client.
|
|
4
4
|
*
|
|
5
|
-
* This client is customized with hooks to integrate with Output
|
|
5
|
+
* This client is customized with hooks to integrate with Output.ai tracing.
|
|
6
6
|
*
|
|
7
7
|
* @example
|
|
8
8
|
* ```ts
|
|
@@ -19,7 +19,7 @@ import type { Options } from 'ky';
|
|
|
19
19
|
* ```
|
|
20
20
|
*
|
|
21
21
|
* @param options - The ky options to extend the base client.
|
|
22
|
-
* @returns A ky instance extended with Output
|
|
22
|
+
* @returns A ky instance extended with Output.ai tracing hooks.
|
|
23
23
|
*/
|
|
24
24
|
export declare function httpClient(options?: Options): import("ky").KyInstance;
|
|
25
25
|
export { HTTPError, TimeoutError } from 'ky';
|
package/dist/index.js
CHANGED
|
@@ -26,7 +26,7 @@ const applyDefaultOptions = (userOptions) => (parentOptions) => {
|
|
|
26
26
|
/**
|
|
27
27
|
* Creates a ky client.
|
|
28
28
|
*
|
|
29
|
-
* This client is customized with hooks to integrate with Output
|
|
29
|
+
* This client is customized with hooks to integrate with Output.ai tracing.
|
|
30
30
|
*
|
|
31
31
|
* @example
|
|
32
32
|
* ```ts
|
|
@@ -43,7 +43,7 @@ const applyDefaultOptions = (userOptions) => (parentOptions) => {
|
|
|
43
43
|
* ```
|
|
44
44
|
*
|
|
45
45
|
* @param options - The ky options to extend the base client.
|
|
46
|
-
* @returns A ky instance extended with Output
|
|
46
|
+
* @returns A ky instance extended with Output.ai tracing hooks.
|
|
47
47
|
*/
|
|
48
48
|
export function httpClient(options = {}) {
|
|
49
49
|
return baseHttpClient.extend(applyDefaultOptions(options));
|