@output.ai/http 0.1.1 → 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/README.md CHANGED
@@ -3,83 +3,9 @@
3
3
  HTTP client with built-in tracing for Output Framework workflows.
4
4
 
5
5
  [![npm version](https://img.shields.io/npm/v/@output.ai/http)](https://www.npmjs.com/package/@output.ai/http)
6
- [![Documentation](https://img.shields.io/badge/docs-docs.output.ai-blue)](https://docs.output.ai/packages/http)
7
-
8
- ## Installation
9
-
10
- ```bash
11
- npm install @output.ai/http
12
- ```
13
-
14
- ## Quick Start
15
-
16
- ```typescript
17
- import { httpClient } from '@output.ai/http';
18
-
19
- const client = httpClient({
20
- prefixUrl: 'https://api.example.com'
21
- });
22
-
23
- const response = await client.get('users/1');
24
- const data = await response.json();
25
- ```
26
-
27
- ## HTTP Methods
28
-
29
- ```typescript
30
- // GET
31
- const users = await client.get('users').json();
32
-
33
- // POST
34
- const newUser = await client.post('users', {
35
- json: { name: 'John', email: 'john@example.com' }
36
- }).json();
37
-
38
- // PUT
39
- await client.put('users/1', {
40
- json: { name: 'Jane' }
41
- });
42
-
43
- // DELETE
44
- await client.delete('users/1');
45
- ```
46
-
47
- ## Using in Steps
48
-
49
- Wrap HTTP calls in steps for automatic retry and tracing:
50
-
51
- ```typescript
52
- import { step, z } from '@output.ai/core';
53
- import { httpClient } from '@output.ai/http';
54
-
55
- const api = httpClient({ prefixUrl: 'https://api.example.com' });
56
-
57
- export const fetchUser = step({
58
- name: 'fetchUser',
59
- inputSchema: z.string(),
60
- outputSchema: z.object({
61
- id: z.string(),
62
- name: z.string()
63
- }),
64
- fn: async (userId) => {
65
- return api.get(`users/${userId}`).json();
66
- }
67
- });
68
- ```
69
-
70
- ## Tracing
71
-
72
- All HTTP requests are automatically traced and visible in the Temporal UI, including request/response details and timing.
73
-
74
- ## Environment Variables
75
-
76
- | Variable | Description |
77
- |----------|-------------|
78
- | `LOG_HTTP_VERBOSE` | Set to `true` for detailed request/response logging |
79
6
 
80
7
  ## Documentation
8
+ - [README](https://docs.output.ai/packages/http)
9
+ - [API Reference](https://output-ai-reference-code-docs.onrender.com/modules/http_src.html)
81
10
 
82
- For comprehensive documentation, visit:
83
-
84
- - [Package Reference](https://docs.output.ai/packages/http)
85
- - [Getting Started](https://docs.output.ai/quickstart)
11
+ <!-- Internal Dev Note: The documentation for this package is found at docs/guides/packages/http.mdx -->
package/dist/config.d.ts CHANGED
@@ -4,7 +4,7 @@
4
4
  export declare const config: {
5
5
  /**
6
6
  * Whether to log verbose HTTP information (headers and bodies)
7
- * Controlled by LOG_HTTP_VERBOSE environment variable
7
+ * Controlled by OUTPUT_TRACE_HTTP_VERBOSE environment variable
8
8
  */
9
9
  logVerbose: boolean;
10
10
  };
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 LOG_HTTP_VERBOSE environment variable
7
+ * Controlled by OUTPUT_TRACE_HTTP_VERBOSE environment variable
8
8
  */
9
- logVerbose: ['1', 'true'].includes(process.env.LOG_HTTP_VERBOSE)
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 SDK tracing
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 SDK tracing
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 SDK tracing
4
- * Respects LOG_HTTP_VERBOSE environment variable for detailed logging
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 SDK tracing
6
- * Respects LOG_HTTP_VERBOSE environment variable for detailed logging
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 SDK tracing
4
- * Respects LOG_HTTP_VERBOSE environment variable for detailed logging
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 SDK tracing
6
- * Respects LOG_HTTP_VERBOSE environment variable for detailed logging
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 SDK tracing.
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 SDK tracing hooks.
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 SDK tracing.
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 SDK tracing hooks.
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));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@output.ai/http",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "description": "Framework abstraction to make HTTP calls with tracing",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",