@uidu/client 3.10.0 → 3.11.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 +6 -0
- package/dist/declarations/src/generated/index.d.ts +4537 -7
- package/dist/declarations/src/index.d.ts +2 -0
- package/dist/declarations/src/sites.d.ts +81 -0
- package/dist/uidu-client.cjs.dev.js +118 -1
- package/dist/uidu-client.cjs.prod.js +118 -1
- package/dist/uidu-client.esm.js +114 -2
- package/package.json +1 -1
- package/src/generated/index.ts +537 -11
- package/src/index.ts +17 -0
- package/src/queries/sites/SiteFields.graphql +51 -0
- package/src/queries/sites/SiteQueries.graphql +53 -0
- package/src/sites.test.ts +315 -0
- package/src/sites.ts +173 -0
|
@@ -7,6 +7,8 @@ export { normalizeFieldValueContent, normalizeFieldValuesAttributes, } from "./u
|
|
|
7
7
|
export { ListApplicationsDocument, ListBookingsDocument, ListCalendarsDocument, ListCalendarEventsDocument, ListCallsDocument, ListCampaignsDocument, ListEmailCampaignsDocument, ListCoursesDocument, ListDealsDocument, ListDonationCampaignsDocument, ListEmployeesDocument, ListEnrollmentsDocument, ListEventsDocument, ListFormsDocument, ListKbArticlesDocument, ListKbCollectionsDocument, ListLecturesDocument, ListPagesDocument, ListStoriesDocument, } from "./generated/index.js";
|
|
8
8
|
export { getPage, listPages, getTemplate, createProject, createPage, createPageBlock, createFieldValue, listProjects, } from "./cms.js";
|
|
9
9
|
export type { Page, Template } from "./cms.js";
|
|
10
|
+
export { getSiteByDomain, getSite, getPageBySlug, listSitePages, getSingletonBlock, } from "./sites.js";
|
|
11
|
+
export type { Site, SiteModel, SiteFields, SiteBlock, SitePage, SitePageSummary, } from "./sites.js";
|
|
10
12
|
export { createWorkspace, generateWorkspaceApiCredentials } from "./system.js";
|
|
11
13
|
export { createSpace } from "./spaces.js";
|
|
12
14
|
export { createTask } from "./tasks.js";
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { UiduClient } from "./client.js";
|
|
2
|
+
import { type PublishableStatus, type SiteFieldsFragment, type SiteModelFieldsFragment } from "./generated/index.js";
|
|
3
|
+
/**
|
|
4
|
+
* The new CMS: a Site, its page types (page-kind Models), its pages
|
|
5
|
+
* (ModelItems of those Models) and the blocks placed on each page (block-kind
|
|
6
|
+
* ModelItems, in order).
|
|
7
|
+
*
|
|
8
|
+
* This is not the legacy CMS in `cms.ts` (`getPage`/`listPages`, read
|
|
9
|
+
* through `currentWorkspace.project(id:)`): sites still deployed on a legacy
|
|
10
|
+
* Project keep calling those, unchanged. Use this module for Sites.
|
|
11
|
+
*
|
|
12
|
+
* Every read here is public: it works with a `publicToken` client, on the
|
|
13
|
+
* server (RSC) and in the browser.
|
|
14
|
+
*/
|
|
15
|
+
export type Site = SiteFieldsFragment;
|
|
16
|
+
/** A Model as the site sees it: a page type, a block kind, a singleton. */
|
|
17
|
+
export type SiteModel = SiteModelFieldsFragment;
|
|
18
|
+
/** Field values keyed by field shortname: `{ title: '…', cover: {…} }`. */
|
|
19
|
+
export type SiteFields = Record<string, unknown>;
|
|
20
|
+
export type SiteBlock = {
|
|
21
|
+
/** The block ModelItem. */
|
|
22
|
+
id: string;
|
|
23
|
+
name: string | null;
|
|
24
|
+
/** The block kind (a block-kind Model). */
|
|
25
|
+
model: SiteModel;
|
|
26
|
+
fields: SiteFields;
|
|
27
|
+
position: number;
|
|
28
|
+
/** The placement (the child FieldValue) — what reordering/removing targets. */
|
|
29
|
+
placementId: string;
|
|
30
|
+
};
|
|
31
|
+
export type SitePageSummary = {
|
|
32
|
+
id: string;
|
|
33
|
+
name: string | null;
|
|
34
|
+
slug: string | null;
|
|
35
|
+
publishedAt: string | null;
|
|
36
|
+
status: PublishableStatus | null;
|
|
37
|
+
/** The page type (a page-kind Model), or the singleton Model. */
|
|
38
|
+
model: SiteModel;
|
|
39
|
+
};
|
|
40
|
+
export type SitePage = SitePageSummary & {
|
|
41
|
+
fields: SiteFields;
|
|
42
|
+
/** Ordered by position. */
|
|
43
|
+
blocks: SiteBlock[];
|
|
44
|
+
};
|
|
45
|
+
/** The Site served on `domain` (e.g. `www.acme.org`), or null. */
|
|
46
|
+
export declare function getSiteByDomain(client: UiduClient, variables: {
|
|
47
|
+
domain: string;
|
|
48
|
+
}): Promise<Site | null>;
|
|
49
|
+
/** A Site by its id — for previews, where there is no domain to go by. */
|
|
50
|
+
export declare function getSite(client: UiduClient, variables: {
|
|
51
|
+
id: string;
|
|
52
|
+
}): Promise<Site | null>;
|
|
53
|
+
/**
|
|
54
|
+
* A page of the Site by slug, with its field values and its ordered blocks.
|
|
55
|
+
* Only published pages unless `includeDrafts`.
|
|
56
|
+
*/
|
|
57
|
+
export declare function getPageBySlug(client: UiduClient, variables: {
|
|
58
|
+
siteId: string;
|
|
59
|
+
slug: string;
|
|
60
|
+
includeDrafts?: boolean;
|
|
61
|
+
}): Promise<SitePage | null>;
|
|
62
|
+
/**
|
|
63
|
+
* The Site's pages, for navigation and sitemaps: published only unless
|
|
64
|
+
* `includeDrafts`, singletons (header, footer) left out.
|
|
65
|
+
*
|
|
66
|
+
* `pageType` keeps the pages of one page type, matched against its Model's
|
|
67
|
+
* id or name.
|
|
68
|
+
*/
|
|
69
|
+
export declare function listSitePages(client: UiduClient, variables: {
|
|
70
|
+
siteId: string;
|
|
71
|
+
pageType?: string;
|
|
72
|
+
includeDrafts?: boolean;
|
|
73
|
+
}): Promise<SitePageSummary[]>;
|
|
74
|
+
/**
|
|
75
|
+
* A singleton of the Site — the header, the footer, the nav — by its Model's
|
|
76
|
+
* shortname, with its field values and blocks.
|
|
77
|
+
*/
|
|
78
|
+
export declare function getSingletonBlock(client: UiduClient, variables: {
|
|
79
|
+
siteId: string;
|
|
80
|
+
shortname: string;
|
|
81
|
+
}): Promise<SitePage | null>;
|