@hlix/sdk 0.2.0 → 0.3.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/api-client/src/client.d.ts +43 -0
- package/dist/api-client/src/generated/schema.d.ts +26163 -0
- package/dist/api-client/src/index.d.ts +13 -0
- package/dist/auth.d.ts +41 -0
- package/dist/errors.d.ts +78 -0
- package/dist/http.d.ts +45 -0
- package/dist/index.d.ts +268 -9395
- package/dist/index.js +449 -277
- package/dist/observe.d.ts +58 -0
- package/dist/retry.d.ts +47 -0
- package/dist/revision-watch.d.ts +29 -0
- package/dist/streaming.d.ts +33 -0
- package/dist/test-schema-guard.d.ts +27 -0
- package/package.json +6 -6
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The typed transport for the hlix API.
|
|
3
|
+
*
|
|
4
|
+
* TRANSPORT-ONLY, and that is a constraint rather than a stage of completion:
|
|
5
|
+
*
|
|
6
|
+
* - no retries — a caller that retries a non-idempotent POST duplicates work,
|
|
7
|
+
* and only the caller knows whether that is safe;
|
|
8
|
+
* - no caching — a client that serves a stale project silently disagrees with
|
|
9
|
+
* the server, and cache invalidation is the consumer's problem (the web app
|
|
10
|
+
* already has TanStack Query for exactly this);
|
|
11
|
+
* - no auth policy — no credential storage, no token refresh, no re-auth on
|
|
12
|
+
* 401. The client sends the headers it is handed and reports what came back.
|
|
13
|
+
*
|
|
14
|
+
* Everything in that list is real and useful; it belongs to the SDK, which is
|
|
15
|
+
* allowed to be opinionated. This layer is what the SDK, the CLI, the docs and
|
|
16
|
+
* any third-party integrator share, so an opinion added here is one nobody can
|
|
17
|
+
* opt out of. `transport-only.test.ts` asserts each of those three by
|
|
18
|
+
* behaviour, not by comment.
|
|
19
|
+
*
|
|
20
|
+
* The types come from `generated/schema.ts`, which is generated from
|
|
21
|
+
* `apps/backend/openapi.json` and checked in. This package has NO dependency on
|
|
22
|
+
* `apps/backend` — see `no-backend-dependency.test.ts`.
|
|
23
|
+
*/
|
|
24
|
+
import { type Client } from "openapi-fetch";
|
|
25
|
+
import type { paths } from "./generated/schema";
|
|
26
|
+
export interface HlixClientOptions {
|
|
27
|
+
/** Origin the API is served from, e.g. `https://server.hlix.ai`. */
|
|
28
|
+
baseUrl: string;
|
|
29
|
+
/**
|
|
30
|
+
* Headers sent on every request — authentication and tenancy included.
|
|
31
|
+
*
|
|
32
|
+
* A STATIC record, deliberately. Accepting a callback here would be the
|
|
33
|
+
* first inch of an auth policy: something that refreshes a token has to
|
|
34
|
+
* decide when a token is stale, and that decision is the SDK's. A caller
|
|
35
|
+
* whose credentials rotate builds a new client or passes headers per call.
|
|
36
|
+
*/
|
|
37
|
+
headers?: Record<string, string>;
|
|
38
|
+
/** Override `globalThis.fetch` — for tests, or a runtime that has its own. */
|
|
39
|
+
fetch?: (input: Request) => Promise<Response>;
|
|
40
|
+
}
|
|
41
|
+
/** The typed client: one method per HTTP verb, keyed by documented path. */
|
|
42
|
+
export type HlixClient = Client<paths>;
|
|
43
|
+
export declare function createHlixClient(options: HlixClientOptions): HlixClient;
|