@output.ai/http 0.1.0 → 0.1.2
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 +6 -21
- package/dist/index.d.ts +6 -4
- package/dist/index.js +6 -5
- package/package.json +6 -3
package/README.md
CHANGED
|
@@ -1,26 +1,11 @@
|
|
|
1
1
|
# @output.ai/http
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
HTTP client with built-in tracing for Output Framework workflows.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
[](https://www.npmjs.com/package/@output.ai/http)
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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)
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
```typescript
|
|
14
|
-
import { httpClient } from '@output.ai/http';
|
|
15
|
-
|
|
16
|
-
const client = httpClient({
|
|
17
|
-
prefixUrl: 'https://api.example.com'
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
const response = await client.get('users/1');
|
|
21
|
-
const userData = await response.json();
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
## Environment Variables
|
|
25
|
-
|
|
26
|
-
- `LOG_HTTP_VERBOSE=true` - Enables detailed request/response logging including headers and body
|
|
11
|
+
<!-- Internal Dev Note: The documentation for this package is found at docs/guides/packages/http.mdx -->
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import type { Options } from 'ky';
|
|
2
2
|
/**
|
|
3
|
-
* Creates
|
|
3
|
+
* Creates a ky client.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
* @returns Extended ky instance with Output SDK hooks
|
|
5
|
+
* This client is customized with hooks to integrate with Output SDK tracing.
|
|
7
6
|
*
|
|
8
7
|
* @example
|
|
9
|
-
* ```
|
|
8
|
+
* ```ts
|
|
10
9
|
* import { httpClient } from '@output.ai/http';
|
|
11
10
|
*
|
|
12
11
|
* const client = httpClient({
|
|
@@ -18,6 +17,9 @@ import type { Options } from 'ky';
|
|
|
18
17
|
* const response = await client.get('users/1');
|
|
19
18
|
* const data = await response.json();
|
|
20
19
|
* ```
|
|
20
|
+
*
|
|
21
|
+
* @param options - The ky options to extend the base client.
|
|
22
|
+
* @returns A ky instance extended with Output SDK tracing hooks.
|
|
21
23
|
*/
|
|
22
24
|
export declare function httpClient(options?: Options): import("ky").KyInstance;
|
|
23
25
|
export { HTTPError, TimeoutError } from 'ky';
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import ky from 'ky';
|
|
2
2
|
import { assignRequestId, traceRequest, traceResponse, traceError } from './hooks/index.js';
|
|
3
3
|
import { applyFetchErrorTracing } from '#hooks/trace_error.js';
|
|
4
|
-
// Create base HTTP client with standard Output SDK tracing hooks
|
|
5
4
|
const baseHttpClient = ky.create({
|
|
6
5
|
hooks: {
|
|
7
6
|
beforeRequest: [
|
|
@@ -25,13 +24,12 @@ const applyDefaultOptions = (userOptions) => (parentOptions) => {
|
|
|
25
24
|
};
|
|
26
25
|
};
|
|
27
26
|
/**
|
|
28
|
-
* Creates
|
|
27
|
+
* Creates a ky client.
|
|
29
28
|
*
|
|
30
|
-
*
|
|
31
|
-
* @returns Extended ky instance with Output SDK hooks
|
|
29
|
+
* This client is customized with hooks to integrate with Output SDK tracing.
|
|
32
30
|
*
|
|
33
31
|
* @example
|
|
34
|
-
* ```
|
|
32
|
+
* ```ts
|
|
35
33
|
* import { httpClient } from '@output.ai/http';
|
|
36
34
|
*
|
|
37
35
|
* const client = httpClient({
|
|
@@ -43,6 +41,9 @@ const applyDefaultOptions = (userOptions) => (parentOptions) => {
|
|
|
43
41
|
* const response = await client.get('users/1');
|
|
44
42
|
* const data = await response.json();
|
|
45
43
|
* ```
|
|
44
|
+
*
|
|
45
|
+
* @param options - The ky options to extend the base client.
|
|
46
|
+
* @returns A ky instance extended with Output SDK tracing hooks.
|
|
46
47
|
*/
|
|
47
48
|
export function httpClient(options = {}) {
|
|
48
49
|
return baseHttpClient.extend(applyDefaultOptions(options));
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@output.ai/http",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Framework abstraction to make HTTP calls with tracing",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
|
-
"types": "dist/index.d.
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
8
|
"files": [
|
|
9
9
|
"dist"
|
|
10
10
|
],
|
|
@@ -15,7 +15,10 @@
|
|
|
15
15
|
"@output.ai/core": ">=0.0.1",
|
|
16
16
|
"ky": "~1.9.1"
|
|
17
17
|
},
|
|
18
|
-
"license": "
|
|
18
|
+
"license": "Apache-2.0",
|
|
19
|
+
"publishConfig": {
|
|
20
|
+
"access": "public"
|
|
21
|
+
},
|
|
19
22
|
"imports": {
|
|
20
23
|
"#*": "./dist/*"
|
|
21
24
|
}
|