@cloudfleet/sdk 0.0.1-cfddf24 → 0.0.1-d06768f
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 +56 -2
- package/dist/@tanstack/react-query.gen.d.ts +432 -614
- package/dist/@tanstack/react-query.gen.d.ts.map +1 -1
- package/dist/@tanstack/react-query.gen.js +431 -404
- package/dist/@tanstack/react-query.gen.js.map +1 -1
- package/dist/client/client.gen.d.ts.map +1 -1
- package/dist/client/client.gen.js +1 -4
- package/dist/client/client.gen.js.map +1 -1
- package/dist/client/types.gen.d.ts +1 -1
- package/dist/client/types.gen.d.ts.map +1 -1
- package/dist/client/utils.gen.d.ts +2 -2
- package/dist/client/utils.gen.d.ts.map +1 -1
- package/dist/client/utils.gen.js +3 -3
- package/dist/client/utils.gen.js.map +1 -1
- package/dist/core/params.gen.js +4 -4
- package/dist/core/params.gen.js.map +1 -1
- package/dist/errors.d.ts +42 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +83 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/schemas.gen.d.ts +778 -487
- package/dist/schemas.gen.d.ts.map +1 -1
- package/dist/schemas.gen.js +1050 -630
- package/dist/schemas.gen.js.map +1 -1
- package/dist/sdk.gen.d.ts +226 -221
- package/dist/sdk.gen.d.ts.map +1 -1
- package/dist/sdk.gen.js +340 -324
- package/dist/sdk.gen.js.map +1 -1
- package/dist/services/kubernetes/api.d.ts +18 -55
- package/dist/services/kubernetes/api.d.ts.map +1 -1
- package/dist/services/kubernetes/api.js +36 -75
- package/dist/services/kubernetes/api.js.map +1 -1
- package/dist/services/kubernetes/index.d.ts.map +1 -1
- package/dist/services/kubernetes/index.js +36 -37
- package/dist/services/kubernetes/index.js.map +1 -1
- package/dist/types.gen.d.ts +1253 -989
- package/dist/types.gen.d.ts.map +1 -1
- package/dist/zod.gen.d.ts +1886 -1537
- package/dist/zod.gen.d.ts.map +1 -1
- package/dist/zod.gen.js +586 -393
- package/dist/zod.gen.js.map +1 -1
- package/package.json +10 -15
package/README.md
CHANGED
|
@@ -1,9 +1,63 @@
|
|
|
1
|
-
# Cloudfleet TypeScript
|
|
1
|
+
# Cloudfleet SDK for TypeScript & JavaScript
|
|
2
2
|
|
|
3
|
-
TypeScript
|
|
3
|
+
Official TypeScript/JavaScript SDK for the [Cloudfleet](https://cloudfleet.ai) API.
|
|
4
|
+
|
|
5
|
+
[Cloudfleet](https://cloudfleet.ai) is a managed Kubernetes platform that runs your clusters across any cloud and your own bare-metal servers. This SDK is a fully typed client for automating clusters, fleets, nodes, and billing from Node.js, the browser, or any TypeScript project.
|
|
6
|
+
|
|
7
|
+
- 🌐 Homepage: [cloudfleet.ai](https://cloudfleet.ai)
|
|
8
|
+
- 📚 Docs: [cloudfleet.ai/docs](https://cloudfleet.ai/docs)
|
|
4
9
|
|
|
5
10
|
## Installation
|
|
6
11
|
|
|
7
12
|
```bash
|
|
8
13
|
npm install @cloudfleet/sdk
|
|
9
14
|
```
|
|
15
|
+
|
|
16
|
+
## Usage
|
|
17
|
+
|
|
18
|
+
```ts
|
|
19
|
+
import { client } from "@cloudfleet/sdk";
|
|
20
|
+
|
|
21
|
+
client.setConfig({
|
|
22
|
+
baseUrl: "https://api.cloudfleet.ai/v1",
|
|
23
|
+
headers: {
|
|
24
|
+
Authorization: "Bearer <your-token>",
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Errors
|
|
30
|
+
|
|
31
|
+
Failed requests throw (or return as `error` when `throwOnError` is `false`) `Error` subclasses:
|
|
32
|
+
|
|
33
|
+
- `CloudfleetApiError`: the API answered with a non-2xx status. Carries `status`, `method`, `path` (the route template, e.g. `/clusters/{cluster_id}`), `url`, `requestId`, `code`, `reason` (Kubernetes `Status.reason` for cluster proxy calls), and the parsed response `body`. `message` is the body's `message`, or the response text when the body is not JSON. Other body fields, such as Kubernetes `details`, are on `body`.
|
|
34
|
+
- `CloudfleetNetworkError`: no response was received. Carries `method`, `path`, `url`, and the original `fetch` error as `cause`.
|
|
35
|
+
|
|
36
|
+
Aborted requests and request or response validation errors are thrown unchanged.
|
|
37
|
+
|
|
38
|
+
`message` is the server's text and can contain personal data, such as the user's email in Kubernetes RBAC errors. When reporting errors to telemetry, title and group them by `method`, `path` and `status`, which never contain IDs or names.
|
|
39
|
+
|
|
40
|
+
`KubernetesService` calls always throw on failure, regardless of the client's `throwOnError` setting.
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
import { CloudfleetApiError, ClustersService } from "@cloudfleet/sdk";
|
|
44
|
+
|
|
45
|
+
try {
|
|
46
|
+
await ClustersService.getCluster({
|
|
47
|
+
path: { cluster_id: id },
|
|
48
|
+
throwOnError: true,
|
|
49
|
+
});
|
|
50
|
+
} catch (err) {
|
|
51
|
+
if (err instanceof CloudfleetApiError && err.status === 404) {
|
|
52
|
+
// cluster does not exist
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
The default `client` converts errors automatically. For a client made with `createClient`, register the conversion with `registerCloudfleetErrors(myClient)`.
|
|
58
|
+
|
|
59
|
+
The package ships full TypeScript types and an optional [`@tanstack/react-query`](https://tanstack.com/query) integration via `@cloudfleet/sdk/@tanstack/react-query`. See the [Cloudfleet docs](https://cloudfleet.ai/docs) for the full API reference and authentication details.
|
|
60
|
+
|
|
61
|
+
## License
|
|
62
|
+
|
|
63
|
+
MIT
|