@uidu/client 3.6.0 → 3.7.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uidu/client",
3
- "version": "3.6.0",
3
+ "version": "3.7.0",
4
4
  "description": "Typed GraphQL client for the uidu platform. Server-first, framework-agnostic.",
5
5
  "license": "MIT",
6
6
  "author": "uidu",
package/src/cms.ts CHANGED
@@ -15,6 +15,8 @@ import {
15
15
  type GetTemplateQuery,
16
16
  type GetTemplateQueryVariables,
17
17
  ListPagesDocument,
18
+ ListProjectsDocument,
19
+ type ListProjectsQueryVariables,
18
20
  type ListPagesQueryVariables,
19
21
  } from './generated';
20
22
  import { nodes } from './utils/relay';
@@ -87,3 +89,12 @@ export async function createFieldValue(
87
89
  const result = await client.mutate(CreateFieldValueDocument, variables);
88
90
  return result.createFieldValue ?? null;
89
91
  }
92
+
93
+ /** The workspace's CMS projects. A page lives in one, and `getPage` needs its id. */
94
+ export async function listProjects(
95
+ client: UiduClient,
96
+ variables: ListProjectsQueryVariables = {},
97
+ ) {
98
+ const result = await client.query(ListProjectsDocument, variables);
99
+ return nodes(result.currentWorkspace?.projects);
100
+ }