@cube-dev/platform-client 0.0.19 → 0.1.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/CHANGELOG.md +18 -0
- package/README.md +81 -0
- package/dist/react-query/deprecated.d.ts +2 -2
- package/dist/react-query/deprecated.d.ts.map +1 -1
- package/dist/schema.d.ts +317 -268
- package/dist/schema.d.ts.map +1 -1
- package/package.json +4 -1
package/CHANGELOG.md
CHANGED
|
@@ -12,6 +12,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
12
12
|
|
|
13
13
|
## [Unreleased]
|
|
14
14
|
|
|
15
|
+
<!-- Curate public-facing entries here before the next release. -->
|
|
16
|
+
|
|
17
|
+
## [0.1.0] - 2026-06-07
|
|
18
|
+
### Added
|
|
19
|
+
|
|
20
|
+
- `GET /api/v1/deployments/{deploymentId}/folders` now supports cursor-based pagination via the `first` and `after` query parameters, and returns an `items` array alongside a `pageInfo` cursor block — matching the other list endpoints.
|
|
21
|
+
|
|
22
|
+
### Changed
|
|
23
|
+
|
|
24
|
+
- **BREAKING:** The folders list response type `FoldersFindAllResult` is now `FoldersListResponse`.
|
|
25
|
+
- **BREAKING:** Notification recipient types renamed for consistency: `PublicRecipientDto` → `NotificationRecipient`, `PublicRecipientInput` → `NotificationRecipientInput`, `AddRecipientsInput` → `AddNotificationRecipientsInput`, `RemoveRecipientInput` → `RemoveNotificationRecipientInput`, `RemoveRecipientsInput` → `RemoveNotificationRecipientsInput`, `RecipientsListDto` → `NotificationRecipientsListResponse`, `RecipientsMutationResultDto` → `NotificationRecipientsMutationResponse`, `NotificationsListDto` → `NotificationsListResponse`.
|
|
26
|
+
|
|
27
|
+
### Deprecated
|
|
28
|
+
|
|
29
|
+
- The `data` and `count` fields on the folders list response are deprecated in favor of `items` and `pageInfo`. They remain populated for backward compatibility.
|
|
30
|
+
|
|
31
|
+
## [0.0.20] - 2026-06-05
|
|
32
|
+
|
|
15
33
|
### Added
|
|
16
34
|
|
|
17
35
|
- `createCubePlatformClient` — the new name for the client factory.
|
package/README.md
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# @cube-dev/platform-client
|
|
2
|
+
|
|
3
|
+
A typed client for the [Cube Cloud](https://cube.dev/) Platform control-plane REST API. It wraps the public OpenAPI spec with end-to-end types for every endpoint, request, and response, plus optional React Query bindings.
|
|
4
|
+
|
|
5
|
+
## Documentation & changelog
|
|
6
|
+
|
|
7
|
+
- **API reference & guides:** https://docs.cube.dev/api-reference/introduction
|
|
8
|
+
- **Changelog:** https://docs.cube.dev/api-reference/changelog
|
|
9
|
+
|
|
10
|
+
A copy of the per-release changelog also ships in this package as [`CHANGELOG.md`](./CHANGELOG.md).
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install @cube-dev/platform-client
|
|
16
|
+
# or
|
|
17
|
+
yarn add @cube-dev/platform-client
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
import { createCubePlatformClient } from '@cube-dev/platform-client';
|
|
24
|
+
|
|
25
|
+
const client = createCubePlatformClient({
|
|
26
|
+
baseUrl: 'https://<your-tenant>.cubecloud.dev',
|
|
27
|
+
// Called on every request — return the auth headers for the Platform API.
|
|
28
|
+
getHeaders: () => ({ Authorization: process.env.CUBE_API_TOKEN! }),
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
// `fetchClient` is a fully-typed openapi-fetch client: paths, params,
|
|
32
|
+
// request bodies and responses are all checked against the OpenAPI spec.
|
|
33
|
+
const { data, error } = await client.fetchClient.GET('/api/v1/deployments/', {
|
|
34
|
+
params: { query: { first: 50 } },
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
for (const deployment of data?.items ?? []) {
|
|
38
|
+
console.log(deployment.id, deployment.name, deployment.deploymentUrl);
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### React Query bindings
|
|
43
|
+
|
|
44
|
+
The `./react-query` entry point exposes a provider and typed hooks built on [`@tanstack/react-query`](https://tanstack.com/query) (a peer dependency, along with `react`):
|
|
45
|
+
|
|
46
|
+
```tsx
|
|
47
|
+
import { createCubePlatformClient } from '@cube-dev/platform-client';
|
|
48
|
+
import {
|
|
49
|
+
CubePlatformApiProvider,
|
|
50
|
+
useCubePlatformApiQuery,
|
|
51
|
+
} from '@cube-dev/platform-client/react-query';
|
|
52
|
+
|
|
53
|
+
const client = createCubePlatformClient({ baseUrl, getHeaders });
|
|
54
|
+
|
|
55
|
+
function App() {
|
|
56
|
+
return (
|
|
57
|
+
<CubePlatformApiProvider client={client}>
|
|
58
|
+
<Deployments />
|
|
59
|
+
</CubePlatformApiProvider>
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function Deployments() {
|
|
64
|
+
const { data } = useCubePlatformApiQuery('get', '/api/v1/deployments/');
|
|
65
|
+
return <ul>{data?.items.map((deployment) => <li key={deployment.id}>{deployment.name}</li>)}</ul>;
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Types
|
|
70
|
+
|
|
71
|
+
The full set of schema types is exported as `PlatformApiSchemas`, and the raw OpenAPI `paths` / `operations` types are available for advanced use:
|
|
72
|
+
|
|
73
|
+
```ts
|
|
74
|
+
import type { PlatformApiSchemas, paths } from '@cube-dev/platform-client';
|
|
75
|
+
|
|
76
|
+
type Deployment = PlatformApiSchemas['Deployment'];
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## License
|
|
80
|
+
|
|
81
|
+
MIT
|
|
@@ -11,11 +11,11 @@ export type CubeCloudApiProviderProps = CubePlatformApiProviderProps;
|
|
|
11
11
|
/** @deprecated Renamed to {@link useCubePlatformApi}. */
|
|
12
12
|
export declare const useCubeCloudApi: typeof useCubePlatformApi;
|
|
13
13
|
/** @deprecated Renamed to {@link useCubePlatformApiQuery}. */
|
|
14
|
-
export declare const useCubeCloudApiQuery: <Method extends HttpMethod, Path extends PathsWithMethod<paths, Method>, Init extends import("openapi-fetch").MaybeOptionalInit<paths[Path], Method>, Response extends Required<import("openapi-fetch").FetchResponse<paths[Path][Method] & Record<string, any>, Init, import("openapi-typescript-helpers").MediaType>>, Options extends Omit<import("@tanstack/react-query").UseQueryOptions<Response[
|
|
14
|
+
export declare const useCubeCloudApiQuery: <Method extends HttpMethod, Path extends PathsWithMethod<paths, Method>, Init extends import("openapi-fetch").MaybeOptionalInit<paths[Path], Method>, Response extends Required<import("openapi-fetch").FetchResponse<paths[Path][Method] & Record<string, any>, Init, import("openapi-typescript-helpers").MediaType>>, Options extends Omit<import("@tanstack/react-query").UseQueryOptions<Response["data"], any, Options["select"] extends infer T ? T extends Options["select"] ? T extends (data: Response["data"]) => infer R ? R : Response["data"] : never : never, any>, "queryKey" | "queryFn">>(method: Method, url: Path, ...[init, options, queryClient]: import("openapi-typescript-helpers").RequiredKeysOf<Init> extends never ? [(Init & {
|
|
15
15
|
[key: string]: unknown;
|
|
16
16
|
})?, Options?, import("@tanstack/query-core").QueryClient?] : [Init & {
|
|
17
17
|
[key: string]: unknown;
|
|
18
|
-
}, Options?, import("@tanstack/query-core").QueryClient?]) => import("@tanstack/react-query").UseQueryResult<Options["select"] extends infer
|
|
18
|
+
}, Options?, import("@tanstack/query-core").QueryClient?]) => import("@tanstack/react-query").UseQueryResult<Options["select"] extends infer T_1 ? T_1 extends Options["select"] ? T_1 extends (data: Response["data"]) => infer R ? R : Response["data"] : never : never, any>;
|
|
19
19
|
/** @deprecated Renamed to {@link useCubePlatformApiSuspenseQuery}. */
|
|
20
20
|
export declare const useCubeCloudApiSuspenseQuery: import("openapi-react-query").UseSuspenseQueryMethod<paths, `${string}/${string}`>;
|
|
21
21
|
/** @deprecated Renamed to {@link useCubePlatformApiMutation}. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deprecated.d.ts","sourceRoot":"","sources":["../../src/react-query/deprecated.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,kBAAkB,EAIlB,2BAA2B,EAE5B,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAEvE,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC9E,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,8BAA8B,CAAC;AACjF,OAAO,KAAK,EAAE,uBAAuB,EAAE,iCAAiC,EAAE,MAAM,YAAY,CAAC;AAC7F,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAE1C,8DAA8D;AAC9D,eAAO,MAAM,oBAAoB,gCAA0B,CAAC;AAC5D,mEAAmE;AACnE,MAAM,MAAM,yBAAyB,GAAG,4BAA4B,CAAC;AAErE,yDAAyD;AACzD,eAAO,MAAM,eAAe,2BAAqB,CAAC;AAClD,8DAA8D;AAC9D,eAAO,MAAM,oBAAoB
|
|
1
|
+
{"version":3,"file":"deprecated.d.ts","sourceRoot":"","sources":["../../src/react-query/deprecated.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,kBAAkB,EAIlB,2BAA2B,EAE5B,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAEvE,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC9E,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,8BAA8B,CAAC;AACjF,OAAO,KAAK,EAAE,uBAAuB,EAAE,iCAAiC,EAAE,MAAM,YAAY,CAAC;AAC7F,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAE1C,8DAA8D;AAC9D,eAAO,MAAM,oBAAoB,gCAA0B,CAAC;AAC5D,mEAAmE;AACnE,MAAM,MAAM,yBAAyB,GAAG,4BAA4B,CAAC;AAErE,yDAAyD;AACzD,eAAO,MAAM,eAAe,2BAAqB,CAAC;AAClD,8DAA8D;AAC9D,eAAO,MAAM,oBAAoB;;;;+QAA0B,CAAC;AAC5D,sEAAsE;AACtE,eAAO,MAAM,4BAA4B,oFAAkC,CAAC;AAC5E,iEAAiE;AACjE,eAAO,MAAM,uBAAuB,+EAA6B,CAAC;AAClE,kEAAkE;AAClE,eAAO,MAAM,wBAAwB,oCAA8B,CAAC;AACpE,qEAAqE;AACrE,eAAO,MAAM,2BAA2B,kFAAiC,CAAC;AAE1E,8DAA8D;AAC9D,MAAM,MAAM,oBAAoB,CAC9B,MAAM,SAAS,UAAU,EACzB,IAAI,SAAS,eAAe,CAAC,KAAK,EAAE,MAAM,CAAC,IACzC,uBAAuB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AAE1C,wEAAwE;AACxE,MAAM,MAAM,8BAA8B,CAAC,KAAK,EAAE,MAAM,IAAI,iCAAiC,CAC3F,KAAK,EACL,MAAM,CACP,CAAC"}
|