@theholocron/http-client 0.2.0 → 0.2.1

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.
Files changed (2) hide show
  1. package/README.md +13 -13
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -18,9 +18,9 @@ Factory that returns a `RestClient` — a thin fetch wrapper with bearer/API-key
18
18
  import { createRestClient } from "@theholocron/http-client";
19
19
 
20
20
  const client = createRestClient({
21
- baseUrl: "https://api.example.com",
22
- token: process.env.EXAMPLE_TOKEN!,
23
- vendor: "Example", // prefix for error messages
21
+ baseUrl: "https://api.example.com",
22
+ token: process.env.EXAMPLE_TOKEN!,
23
+ vendor: "Example", // prefix for error messages
24
24
  });
25
25
 
26
26
  const data = await client.request<{ id: string }>("/widgets/42");
@@ -47,12 +47,12 @@ Factory for the standard 4-step token resolution used by all holocron plugins: `
47
47
  import { createResolveToken, AuthError } from "@theholocron/http-client";
48
48
 
49
49
  export const resolveToken = createResolveToken({
50
- envName: "HOLOCRON_EXAMPLE_TOKEN",
51
- vendorEnvName: "EXAMPLE_TOKEN",
52
- keyringService: "example",
53
- errorMessage:
54
- "no Example token found. Pass --token <TOKEN>, set HOLOCRON_EXAMPLE_TOKEN / EXAMPLE_TOKEN, " +
55
- "or run: holocron auth set example <TOKEN>",
50
+ envName: "HOLOCRON_EXAMPLE_TOKEN",
51
+ vendorEnvName: "EXAMPLE_TOKEN",
52
+ keyringService: "example",
53
+ errorMessage:
54
+ "no Example token found. Pass --token <TOKEN>, set HOLOCRON_EXAMPLE_TOKEN / EXAMPLE_TOKEN, " +
55
+ "or run: holocron auth set example <TOKEN>",
56
56
  });
57
57
  ```
58
58
 
@@ -64,11 +64,11 @@ Thrown by `createRestClient` on non-2xx responses and transport failures. Carrie
64
64
  import { ProviderApiError } from "@theholocron/http-client";
65
65
 
66
66
  try {
67
- await client.request("/endpoint");
67
+ await client.request("/endpoint");
68
68
  } catch (err) {
69
- if (err instanceof ProviderApiError) {
70
- console.error(err.status, err.details);
71
- }
69
+ if (err instanceof ProviderApiError) {
70
+ console.error(err.status, err.details);
71
+ }
72
72
  }
73
73
  ```
74
74
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theholocron/http-client",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Shared HTTP primitives for theholocron — REST client factory, auth resolver, and error types",
5
5
  "homepage": "https://github.com/theholocron/clients/tree/main/packages/http-client#readme",
6
6
  "bugs": "https://github.com/theholocron/clients/issues",