@riverbankcms/sdk 0.2.1 → 0.4.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/README.md +255 -1
- package/dist/cli/index.js +249 -40
- package/dist/cli/index.js.map +1 -1
- package/dist/client/bookings.js +15 -1
- package/dist/client/bookings.js.map +1 -1
- package/dist/client/bookings.mjs +15 -1
- package/dist/client/bookings.mjs.map +1 -1
- package/dist/client/client.d.mts +2 -2
- package/dist/client/client.d.ts +2 -2
- package/dist/client/client.js +51 -6
- package/dist/client/client.js.map +1 -1
- package/dist/client/client.mjs +51 -6
- package/dist/client/client.mjs.map +1 -1
- package/dist/client/hooks.d.mts +2 -2
- package/dist/client/hooks.d.ts +2 -2
- package/dist/client/rendering/client.js +114 -116
- package/dist/client/rendering/client.js.map +1 -1
- package/dist/client/rendering/client.mjs +114 -116
- package/dist/client/rendering/client.mjs.map +1 -1
- package/dist/client/usePage-BcjWPXvh.d.mts +6388 -0
- package/dist/client/usePage-C3ZKNwY7.d.mts +6393 -0
- package/dist/client/usePage-CrKw1H6Y.d.ts +6338 -0
- package/dist/client/usePage-CyYpOJud.d.ts +6388 -0
- package/dist/client/usePage-DMI8ImsU.d.mts +6338 -0
- package/dist/client/usePage-gpVaeWDy.d.ts +6393 -0
- package/dist/server/{Layout-DK_9OOgb.d.mts → Layout-B_zUr9ci.d.mts} +1 -1
- package/dist/server/{Layout-CLg8oH_S.d.ts → Layout-CHG77dhK.d.ts} +1 -1
- package/dist/server/blockKinds-B6MWzNWp.d.mts +16 -0
- package/dist/server/blockKinds-B6MWzNWp.d.ts +16 -0
- package/dist/server/chunk-BOHTTHY5.mjs +406 -0
- package/dist/server/chunk-BOHTTHY5.mjs.map +1 -0
- package/dist/server/{chunk-5R4NMVXA.js → chunk-BUCJWG6G.js} +5 -5
- package/dist/server/chunk-BUCJWG6G.js.map +1 -0
- package/dist/server/chunk-D2QLTPUJ.mjs +33 -0
- package/dist/server/chunk-D2QLTPUJ.mjs.map +1 -0
- package/dist/server/{chunk-62ZJI564.js → chunk-FPYK6527.js} +4 -4
- package/dist/server/{chunk-62ZJI564.js.map → chunk-FPYK6527.js.map} +1 -1
- package/dist/server/{chunk-YXDDFG3N.js → chunk-G4CKM4EN.js} +1 -1
- package/dist/server/chunk-G4CKM4EN.js.map +1 -0
- package/dist/server/chunk-GERCMTPQ.js +33 -0
- package/dist/server/chunk-GERCMTPQ.js.map +1 -0
- package/dist/server/{chunk-SF63XAX7.js → chunk-IT5ICP43.js} +24 -4
- package/dist/server/chunk-IT5ICP43.js.map +1 -0
- package/dist/server/{chunk-GWBMJPLH.mjs → chunk-M5KTLZTD.mjs} +1 -1
- package/dist/server/chunk-M5KTLZTD.mjs.map +1 -0
- package/dist/server/{chunk-3J46ILMJ.mjs → chunk-N3PX76AP.mjs} +29 -4
- package/dist/server/chunk-N3PX76AP.mjs.map +1 -0
- package/dist/server/{chunk-O5DC7MYW.mjs → chunk-NKXS4TBK.mjs} +24 -4
- package/dist/server/chunk-NKXS4TBK.mjs.map +1 -0
- package/dist/server/{chunk-INWKF3IC.js → chunk-P6CDRJN3.js} +8 -8
- package/dist/server/{chunk-INWKF3IC.js.map → chunk-P6CDRJN3.js.map} +1 -1
- package/dist/server/{chunk-GKYNDDJS.js → chunk-R5B6IOFQ.js} +29 -4
- package/dist/server/chunk-R5B6IOFQ.js.map +1 -0
- package/dist/server/{chunk-FK64TZBT.mjs → chunk-SFQ7VF3G.mjs} +2 -2
- package/dist/server/{chunk-JTAERCX2.mjs → chunk-VVFYHAUD.mjs} +2 -2
- package/dist/server/{chunk-PN3CHDVX.mjs → chunk-XK2YIISA.mjs} +2 -2
- package/dist/server/chunk-XK2YIISA.mjs.map +1 -0
- package/dist/server/chunk-ZIM53VP6.js +406 -0
- package/dist/server/chunk-ZIM53VP6.js.map +1 -0
- package/dist/server/{components-DhIcstww.d.ts → components-BYxloYJm.d.ts} +3 -3
- package/dist/server/{components-BzdA6NAc.d.mts → components-Ci5nlyUj.d.mts} +3 -3
- package/dist/server/components.d.mts +7 -5
- package/dist/server/components.d.ts +7 -5
- package/dist/server/components.js +3 -3
- package/dist/server/components.mjs +2 -2
- package/dist/server/config-validation.d.mts +5 -300
- package/dist/server/config-validation.d.ts +5 -300
- package/dist/server/config-validation.js +6 -3
- package/dist/server/config-validation.js.map +1 -1
- package/dist/server/config-validation.mjs +5 -2
- package/dist/server/config.d.mts +43 -4
- package/dist/server/config.d.ts +43 -4
- package/dist/server/config.js +27 -3
- package/dist/server/config.js.map +1 -1
- package/dist/server/config.mjs +26 -2
- package/dist/server/config.mjs.map +1 -1
- package/dist/server/data.d.mts +5 -3
- package/dist/server/data.d.ts +5 -3
- package/dist/server/data.js +2 -2
- package/dist/server/data.mjs +1 -1
- package/dist/server/{index-BB28KAui.d.ts → index-DbSfrRA0.d.ts} +1 -1
- package/dist/server/{index-C_FVup_o.d.mts → index-Dj7VKH34.d.mts} +1 -1
- package/dist/server/index.d.mts +19 -4
- package/dist/server/index.d.ts +19 -4
- package/dist/server/index.js +6 -2
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +5 -1
- package/dist/server/{loadContent-AQOBf_gP.d.ts → loadContent-BqQ-VPMW.d.ts} +4 -3
- package/dist/server/{loadContent-DBmprsB4.d.mts → loadContent-Czu7xTOU.d.mts} +4 -3
- package/dist/server/{loadPage-BMg8PJxJ.d.ts → loadPage-BElEkA_J.d.ts} +3 -2
- package/dist/server/{loadPage-pg4HimlK.d.mts → loadPage-Dw57_n5N.d.mts} +3 -2
- package/dist/server/loadPage-E3ZC6NHB.js +11 -0
- package/dist/server/{loadPage-3ECPF426.js.map → loadPage-E3ZC6NHB.js.map} +1 -1
- package/dist/server/{loadPage-LW273NYO.mjs → loadPage-E7L7NMR3.mjs} +3 -3
- package/dist/server/metadata.d.mts +5 -3
- package/dist/server/metadata.d.ts +5 -3
- package/dist/server/navigation.d.mts +100 -0
- package/dist/server/navigation.d.ts +100 -0
- package/dist/server/navigation.js +44 -0
- package/dist/server/navigation.js.map +1 -0
- package/dist/server/navigation.mjs +44 -0
- package/dist/server/navigation.mjs.map +1 -0
- package/dist/server/rendering/server.d.mts +8 -6
- package/dist/server/rendering/server.d.ts +8 -6
- package/dist/server/rendering/server.js +4 -4
- package/dist/server/rendering/server.mjs +3 -3
- package/dist/server/rendering.d.mts +9 -7
- package/dist/server/rendering.d.ts +9 -7
- package/dist/server/rendering.js +6 -6
- package/dist/server/rendering.mjs +5 -5
- package/dist/server/routing.d.mts +5 -3
- package/dist/server/routing.d.ts +5 -3
- package/dist/server/routing.js +1 -1
- package/dist/server/routing.mjs +1 -1
- package/dist/server/server.d.mts +7 -5
- package/dist/server/server.d.ts +7 -5
- package/dist/server/server.js +4 -4
- package/dist/server/server.mjs +3 -3
- package/dist/server/theme-bridge.js +7 -7
- package/dist/server/theme-bridge.mjs +1 -1
- package/dist/server/{types-BprgZt-t.d.ts → types-5XdVD2J1.d.ts} +43 -147
- package/dist/server/{types-C0G9IxWO.d.mts → types-BA-J9K8r.d.mts} +43 -147
- package/dist/server/types-BC9eB2KH.d.mts +198 -0
- package/dist/server/{types-_nDnPHpv.d.ts → types-BuZJWVmj.d.mts} +4 -1
- package/dist/server/types-CAnC529E.d.ts +198 -0
- package/dist/server/{types--u4GLCAY.d.ts → types-CMqVHYLG.d.ts} +266 -4
- package/dist/server/{types-_zWJTgv0.d.mts → types-CYfHxUhe.d.mts} +266 -4
- package/dist/server/{types-_nDnPHpv.d.mts → types-DSFvXKhO.d.ts} +4 -1
- package/dist/server/validation-C7W2Fe0i.d.ts +459 -0
- package/dist/server/validation-hg1sqhrt.d.mts +459 -0
- package/package.json +23 -17
- package/dist/server/chunk-3J46ILMJ.mjs.map +0 -1
- package/dist/server/chunk-5R4NMVXA.js.map +0 -1
- package/dist/server/chunk-BPKYRPCQ.mjs +0 -215
- package/dist/server/chunk-BPKYRPCQ.mjs.map +0 -1
- package/dist/server/chunk-GKYNDDJS.js.map +0 -1
- package/dist/server/chunk-GWBMJPLH.mjs.map +0 -1
- package/dist/server/chunk-O5DC7MYW.mjs.map +0 -1
- package/dist/server/chunk-PN3CHDVX.mjs.map +0 -1
- package/dist/server/chunk-SF63XAX7.js.map +0 -1
- package/dist/server/chunk-XLVL5WPH.js +0 -215
- package/dist/server/chunk-XLVL5WPH.js.map +0 -1
- package/dist/server/chunk-YXDDFG3N.js.map +0 -1
- package/dist/server/loadPage-3ECPF426.js +0 -11
- /package/dist/server/{chunk-FK64TZBT.mjs.map → chunk-SFQ7VF3G.mjs.map} +0 -0
- /package/dist/server/{chunk-JTAERCX2.mjs.map → chunk-VVFYHAUD.mjs.map} +0 -0
- /package/dist/server/{loadPage-LW273NYO.mjs.map → loadPage-E7L7NMR3.mjs.map} +0 -0
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { A as APIEndpoints } from './types-BA-J9K8r.mjs';
|
|
2
|
+
|
|
3
|
+
type SiteResponse = NonNullable<APIEndpoints['getSite']['response']>;
|
|
4
|
+
type PageResponse = NonNullable<APIEndpoints['getContentByPath']['response']>;
|
|
5
|
+
type EntriesResponse = NonNullable<APIEndpoints['listPublishedEntries']['response']>;
|
|
6
|
+
type EntryResponse = NonNullable<APIEndpoints['getPublishedEntryPreview']['response']>;
|
|
7
|
+
type PublicFormResponse = NonNullable<APIEndpoints['getPublicFormById']['response']>;
|
|
8
|
+
type PublicBookingServicesResponse = NonNullable<APIEndpoints['getPublicBookingServices']['response']>;
|
|
9
|
+
type PublicEventsResponse = NonNullable<APIEndpoints['listPublicEvents']['response']>;
|
|
10
|
+
/**
|
|
11
|
+
* Pagination metadata returned when `includeMeta: true`
|
|
12
|
+
*/
|
|
13
|
+
interface PaginationMeta {
|
|
14
|
+
/** Total number of entries matching the query (estimated if hasMore is true) */
|
|
15
|
+
total: number;
|
|
16
|
+
/** Whether there are more entries after this page */
|
|
17
|
+
hasMore: boolean;
|
|
18
|
+
/** Number of entries per page */
|
|
19
|
+
limit: number;
|
|
20
|
+
/** Number of entries skipped (offset) */
|
|
21
|
+
offset: number;
|
|
22
|
+
/** Total number of pages (estimated if hasMore is true) */
|
|
23
|
+
totalPages: number;
|
|
24
|
+
/** Current page number (1-indexed) */
|
|
25
|
+
currentPage: number;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Response type when includeMeta is true - includes pagination metadata
|
|
29
|
+
*/
|
|
30
|
+
type EntriesResponseWithMeta = {
|
|
31
|
+
entries: EntriesResponse['entries'];
|
|
32
|
+
} & PaginationMeta;
|
|
33
|
+
/**
|
|
34
|
+
* Base parameters for getEntries - shared across all overloads
|
|
35
|
+
*/
|
|
36
|
+
interface GetEntriesBaseParams {
|
|
37
|
+
/** The site ID */
|
|
38
|
+
siteId: string;
|
|
39
|
+
/** The content type key (e.g., 'blog-post', 'product') */
|
|
40
|
+
contentType: string;
|
|
41
|
+
/** Maximum number of entries to return (default: 10, max: 50) */
|
|
42
|
+
limit?: number;
|
|
43
|
+
/** Number of entries to skip for pagination */
|
|
44
|
+
offset?: number;
|
|
45
|
+
/** Sort order for entries. 'order' uses custom ordering (default behavior). */
|
|
46
|
+
order?: 'newest' | 'oldest' | 'title' | 'order';
|
|
47
|
+
/** If true, includes draft entries (requires API key with site access) */
|
|
48
|
+
preview?: boolean;
|
|
49
|
+
/** Selection mode: 'query' for automatic, 'manual' for specific entry IDs */
|
|
50
|
+
mode?: 'query' | 'manual';
|
|
51
|
+
/** Entry IDs to fetch when mode is 'manual' */
|
|
52
|
+
entryIds?: string[];
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Configuration for creating a Riverbank CMS client
|
|
56
|
+
*/
|
|
57
|
+
interface RiverbankClientConfig {
|
|
58
|
+
/**
|
|
59
|
+
* API key for authentication (format: bld_live_... or bld_test_...)
|
|
60
|
+
*/
|
|
61
|
+
apiKey: string;
|
|
62
|
+
/**
|
|
63
|
+
* Base URL for the Riverbank CMS API (required; e.g. https://dashboard.example.com/api)
|
|
64
|
+
*/
|
|
65
|
+
baseUrl: string;
|
|
66
|
+
/**
|
|
67
|
+
* Cache configuration
|
|
68
|
+
*/
|
|
69
|
+
cache?: {
|
|
70
|
+
/**
|
|
71
|
+
* Enable caching (default: true)
|
|
72
|
+
*/
|
|
73
|
+
enabled?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Time-to-live for cached responses in seconds
|
|
76
|
+
* @default 300 (5 minutes)
|
|
77
|
+
*/
|
|
78
|
+
ttl?: number;
|
|
79
|
+
/**
|
|
80
|
+
* Maximum number of cached responses
|
|
81
|
+
* @default 100
|
|
82
|
+
*/
|
|
83
|
+
maxSize?: number;
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Riverbank CMS client interface
|
|
88
|
+
*/
|
|
89
|
+
interface RiverbankClient {
|
|
90
|
+
/**
|
|
91
|
+
* Fetch site data by slug, domain, or ID
|
|
92
|
+
*/
|
|
93
|
+
getSite(params: {
|
|
94
|
+
slug?: string;
|
|
95
|
+
domain?: string;
|
|
96
|
+
id?: string;
|
|
97
|
+
}): Promise<SiteResponse>;
|
|
98
|
+
/**
|
|
99
|
+
* Fetch a specific page by path
|
|
100
|
+
*
|
|
101
|
+
* @param params.preview - If true, returns draft content instead of published content (requires API key with site access)
|
|
102
|
+
*/
|
|
103
|
+
getPage(params: {
|
|
104
|
+
siteId: string;
|
|
105
|
+
path: string;
|
|
106
|
+
preview?: boolean;
|
|
107
|
+
}): Promise<PageResponse>;
|
|
108
|
+
/**
|
|
109
|
+
* Fetch published content entries with optional pagination, sorting, and preview mode
|
|
110
|
+
*
|
|
111
|
+
* @param params.siteId - The site ID
|
|
112
|
+
* @param params.contentType - The content type key (e.g., 'blog-post', 'product')
|
|
113
|
+
* @param params.limit - Maximum number of entries to return (default: 10, max: 50)
|
|
114
|
+
* @param params.offset - Number of entries to skip for pagination (default: 0)
|
|
115
|
+
* @param params.order - Sort order: 'newest' (published_at desc) or 'oldest' (published_at asc)
|
|
116
|
+
* @param params.preview - If true, includes draft entries (requires API key with site access)
|
|
117
|
+
* @param params.mode - 'query' for automatic fetching, 'manual' for specific entry IDs
|
|
118
|
+
* @param params.entryIds - Array of entry IDs to fetch (only used when mode is 'manual')
|
|
119
|
+
* @param params.includeMeta - If true, returns pagination metadata with the response
|
|
120
|
+
*
|
|
121
|
+
* @example
|
|
122
|
+
* ```ts
|
|
123
|
+
* // Fetch latest 10 blog posts
|
|
124
|
+
* const entries = await client.getEntries({
|
|
125
|
+
* siteId: 'site-id',
|
|
126
|
+
* contentType: 'blog-post',
|
|
127
|
+
* limit: 10,
|
|
128
|
+
* order: 'newest',
|
|
129
|
+
* });
|
|
130
|
+
*
|
|
131
|
+
* // Fetch page 3 with pagination metadata
|
|
132
|
+
* const page3 = await client.getEntries({
|
|
133
|
+
* siteId: 'site-id',
|
|
134
|
+
* contentType: 'blog-post',
|
|
135
|
+
* limit: 10,
|
|
136
|
+
* offset: 20,
|
|
137
|
+
* includeMeta: true,
|
|
138
|
+
* });
|
|
139
|
+
* // page3.entries, page3.total, page3.hasMore, page3.currentPage
|
|
140
|
+
*
|
|
141
|
+
* // Fetch specific entries by ID (manual mode)
|
|
142
|
+
* const specific = await client.getEntries({
|
|
143
|
+
* siteId: 'site-id',
|
|
144
|
+
* contentType: 'blog-post',
|
|
145
|
+
* mode: 'manual',
|
|
146
|
+
* entryIds: ['uuid-1', 'uuid-2'],
|
|
147
|
+
* });
|
|
148
|
+
* ```
|
|
149
|
+
*/
|
|
150
|
+
getEntries(params: GetEntriesBaseParams & {
|
|
151
|
+
/** If true, returns pagination metadata with the response */
|
|
152
|
+
includeMeta?: false;
|
|
153
|
+
}): Promise<EntriesResponse>;
|
|
154
|
+
getEntries(params: GetEntriesBaseParams & {
|
|
155
|
+
/** If true, returns pagination metadata with the response */
|
|
156
|
+
includeMeta: true;
|
|
157
|
+
}): Promise<EntriesResponseWithMeta>;
|
|
158
|
+
getEntries(params: GetEntriesBaseParams & {
|
|
159
|
+
includeMeta?: boolean;
|
|
160
|
+
}): Promise<EntriesResponse | EntriesResponseWithMeta>;
|
|
161
|
+
/**
|
|
162
|
+
* Fetch a specific content entry by slug
|
|
163
|
+
*/
|
|
164
|
+
getEntry(params: {
|
|
165
|
+
siteId: string;
|
|
166
|
+
contentType: string;
|
|
167
|
+
slug: string;
|
|
168
|
+
}): Promise<EntryResponse>;
|
|
169
|
+
/**
|
|
170
|
+
* Fetch a public form definition by ID
|
|
171
|
+
*/
|
|
172
|
+
getPublicFormById(params: {
|
|
173
|
+
formId: string;
|
|
174
|
+
}): Promise<PublicFormResponse>;
|
|
175
|
+
/**
|
|
176
|
+
* Fetch public booking services for a site
|
|
177
|
+
*/
|
|
178
|
+
getPublicBookingServices(params: {
|
|
179
|
+
siteId: string;
|
|
180
|
+
ids?: string;
|
|
181
|
+
}): Promise<PublicBookingServicesResponse>;
|
|
182
|
+
/**
|
|
183
|
+
* List public events for a site (optionally time-filtered)
|
|
184
|
+
*/
|
|
185
|
+
listPublicEvents(params: {
|
|
186
|
+
siteId: string;
|
|
187
|
+
limit?: number;
|
|
188
|
+
from?: string;
|
|
189
|
+
to?: string;
|
|
190
|
+
stage?: string;
|
|
191
|
+
}): Promise<PublicEventsResponse>;
|
|
192
|
+
/**
|
|
193
|
+
* Force clear the cache
|
|
194
|
+
*/
|
|
195
|
+
clearCache(): void;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
export type { EntriesResponse as E, PageResponse as P, RiverbankClient as R, SiteResponse as S, RiverbankClientConfig as a, EntryResponse as b, EntriesResponseWithMeta as c, PaginationMeta as d };
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { B as BlockKind } from './blockKinds-B6MWzNWp.mjs';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Data loading types for block prefetching.
|
|
3
5
|
* Shared between frontend and SDK implementations.
|
|
@@ -30,6 +32,7 @@ type ResolvedBlockData = Record<string, Record<string, unknown>>;
|
|
|
30
32
|
* These types enable SDK sites to define loader functions that fetch
|
|
31
33
|
* data from external APIs (not just CMS endpoints).
|
|
32
34
|
*/
|
|
35
|
+
|
|
33
36
|
/**
|
|
34
37
|
* Context provided to code-based data loaders.
|
|
35
38
|
*
|
|
@@ -44,7 +47,7 @@ interface DataLoaderContext {
|
|
|
44
47
|
/** Unique block instance ID */
|
|
45
48
|
blockId: string;
|
|
46
49
|
/** Block kind (e.g., 'custom.featured-products') */
|
|
47
|
-
blockKind:
|
|
50
|
+
blockKind: BlockKind;
|
|
48
51
|
/**
|
|
49
52
|
* The block's CMS content.
|
|
50
53
|
* Use this to access field values for parameterizing API calls.
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { A as APIEndpoints } from './types-5XdVD2J1.js';
|
|
2
|
+
|
|
3
|
+
type SiteResponse = NonNullable<APIEndpoints['getSite']['response']>;
|
|
4
|
+
type PageResponse = NonNullable<APIEndpoints['getContentByPath']['response']>;
|
|
5
|
+
type EntriesResponse = NonNullable<APIEndpoints['listPublishedEntries']['response']>;
|
|
6
|
+
type EntryResponse = NonNullable<APIEndpoints['getPublishedEntryPreview']['response']>;
|
|
7
|
+
type PublicFormResponse = NonNullable<APIEndpoints['getPublicFormById']['response']>;
|
|
8
|
+
type PublicBookingServicesResponse = NonNullable<APIEndpoints['getPublicBookingServices']['response']>;
|
|
9
|
+
type PublicEventsResponse = NonNullable<APIEndpoints['listPublicEvents']['response']>;
|
|
10
|
+
/**
|
|
11
|
+
* Pagination metadata returned when `includeMeta: true`
|
|
12
|
+
*/
|
|
13
|
+
interface PaginationMeta {
|
|
14
|
+
/** Total number of entries matching the query (estimated if hasMore is true) */
|
|
15
|
+
total: number;
|
|
16
|
+
/** Whether there are more entries after this page */
|
|
17
|
+
hasMore: boolean;
|
|
18
|
+
/** Number of entries per page */
|
|
19
|
+
limit: number;
|
|
20
|
+
/** Number of entries skipped (offset) */
|
|
21
|
+
offset: number;
|
|
22
|
+
/** Total number of pages (estimated if hasMore is true) */
|
|
23
|
+
totalPages: number;
|
|
24
|
+
/** Current page number (1-indexed) */
|
|
25
|
+
currentPage: number;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Response type when includeMeta is true - includes pagination metadata
|
|
29
|
+
*/
|
|
30
|
+
type EntriesResponseWithMeta = {
|
|
31
|
+
entries: EntriesResponse['entries'];
|
|
32
|
+
} & PaginationMeta;
|
|
33
|
+
/**
|
|
34
|
+
* Base parameters for getEntries - shared across all overloads
|
|
35
|
+
*/
|
|
36
|
+
interface GetEntriesBaseParams {
|
|
37
|
+
/** The site ID */
|
|
38
|
+
siteId: string;
|
|
39
|
+
/** The content type key (e.g., 'blog-post', 'product') */
|
|
40
|
+
contentType: string;
|
|
41
|
+
/** Maximum number of entries to return (default: 10, max: 50) */
|
|
42
|
+
limit?: number;
|
|
43
|
+
/** Number of entries to skip for pagination */
|
|
44
|
+
offset?: number;
|
|
45
|
+
/** Sort order for entries. 'order' uses custom ordering (default behavior). */
|
|
46
|
+
order?: 'newest' | 'oldest' | 'title' | 'order';
|
|
47
|
+
/** If true, includes draft entries (requires API key with site access) */
|
|
48
|
+
preview?: boolean;
|
|
49
|
+
/** Selection mode: 'query' for automatic, 'manual' for specific entry IDs */
|
|
50
|
+
mode?: 'query' | 'manual';
|
|
51
|
+
/** Entry IDs to fetch when mode is 'manual' */
|
|
52
|
+
entryIds?: string[];
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Configuration for creating a Riverbank CMS client
|
|
56
|
+
*/
|
|
57
|
+
interface RiverbankClientConfig {
|
|
58
|
+
/**
|
|
59
|
+
* API key for authentication (format: bld_live_... or bld_test_...)
|
|
60
|
+
*/
|
|
61
|
+
apiKey: string;
|
|
62
|
+
/**
|
|
63
|
+
* Base URL for the Riverbank CMS API (required; e.g. https://dashboard.example.com/api)
|
|
64
|
+
*/
|
|
65
|
+
baseUrl: string;
|
|
66
|
+
/**
|
|
67
|
+
* Cache configuration
|
|
68
|
+
*/
|
|
69
|
+
cache?: {
|
|
70
|
+
/**
|
|
71
|
+
* Enable caching (default: true)
|
|
72
|
+
*/
|
|
73
|
+
enabled?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Time-to-live for cached responses in seconds
|
|
76
|
+
* @default 300 (5 minutes)
|
|
77
|
+
*/
|
|
78
|
+
ttl?: number;
|
|
79
|
+
/**
|
|
80
|
+
* Maximum number of cached responses
|
|
81
|
+
* @default 100
|
|
82
|
+
*/
|
|
83
|
+
maxSize?: number;
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Riverbank CMS client interface
|
|
88
|
+
*/
|
|
89
|
+
interface RiverbankClient {
|
|
90
|
+
/**
|
|
91
|
+
* Fetch site data by slug, domain, or ID
|
|
92
|
+
*/
|
|
93
|
+
getSite(params: {
|
|
94
|
+
slug?: string;
|
|
95
|
+
domain?: string;
|
|
96
|
+
id?: string;
|
|
97
|
+
}): Promise<SiteResponse>;
|
|
98
|
+
/**
|
|
99
|
+
* Fetch a specific page by path
|
|
100
|
+
*
|
|
101
|
+
* @param params.preview - If true, returns draft content instead of published content (requires API key with site access)
|
|
102
|
+
*/
|
|
103
|
+
getPage(params: {
|
|
104
|
+
siteId: string;
|
|
105
|
+
path: string;
|
|
106
|
+
preview?: boolean;
|
|
107
|
+
}): Promise<PageResponse>;
|
|
108
|
+
/**
|
|
109
|
+
* Fetch published content entries with optional pagination, sorting, and preview mode
|
|
110
|
+
*
|
|
111
|
+
* @param params.siteId - The site ID
|
|
112
|
+
* @param params.contentType - The content type key (e.g., 'blog-post', 'product')
|
|
113
|
+
* @param params.limit - Maximum number of entries to return (default: 10, max: 50)
|
|
114
|
+
* @param params.offset - Number of entries to skip for pagination (default: 0)
|
|
115
|
+
* @param params.order - Sort order: 'newest' (published_at desc) or 'oldest' (published_at asc)
|
|
116
|
+
* @param params.preview - If true, includes draft entries (requires API key with site access)
|
|
117
|
+
* @param params.mode - 'query' for automatic fetching, 'manual' for specific entry IDs
|
|
118
|
+
* @param params.entryIds - Array of entry IDs to fetch (only used when mode is 'manual')
|
|
119
|
+
* @param params.includeMeta - If true, returns pagination metadata with the response
|
|
120
|
+
*
|
|
121
|
+
* @example
|
|
122
|
+
* ```ts
|
|
123
|
+
* // Fetch latest 10 blog posts
|
|
124
|
+
* const entries = await client.getEntries({
|
|
125
|
+
* siteId: 'site-id',
|
|
126
|
+
* contentType: 'blog-post',
|
|
127
|
+
* limit: 10,
|
|
128
|
+
* order: 'newest',
|
|
129
|
+
* });
|
|
130
|
+
*
|
|
131
|
+
* // Fetch page 3 with pagination metadata
|
|
132
|
+
* const page3 = await client.getEntries({
|
|
133
|
+
* siteId: 'site-id',
|
|
134
|
+
* contentType: 'blog-post',
|
|
135
|
+
* limit: 10,
|
|
136
|
+
* offset: 20,
|
|
137
|
+
* includeMeta: true,
|
|
138
|
+
* });
|
|
139
|
+
* // page3.entries, page3.total, page3.hasMore, page3.currentPage
|
|
140
|
+
*
|
|
141
|
+
* // Fetch specific entries by ID (manual mode)
|
|
142
|
+
* const specific = await client.getEntries({
|
|
143
|
+
* siteId: 'site-id',
|
|
144
|
+
* contentType: 'blog-post',
|
|
145
|
+
* mode: 'manual',
|
|
146
|
+
* entryIds: ['uuid-1', 'uuid-2'],
|
|
147
|
+
* });
|
|
148
|
+
* ```
|
|
149
|
+
*/
|
|
150
|
+
getEntries(params: GetEntriesBaseParams & {
|
|
151
|
+
/** If true, returns pagination metadata with the response */
|
|
152
|
+
includeMeta?: false;
|
|
153
|
+
}): Promise<EntriesResponse>;
|
|
154
|
+
getEntries(params: GetEntriesBaseParams & {
|
|
155
|
+
/** If true, returns pagination metadata with the response */
|
|
156
|
+
includeMeta: true;
|
|
157
|
+
}): Promise<EntriesResponseWithMeta>;
|
|
158
|
+
getEntries(params: GetEntriesBaseParams & {
|
|
159
|
+
includeMeta?: boolean;
|
|
160
|
+
}): Promise<EntriesResponse | EntriesResponseWithMeta>;
|
|
161
|
+
/**
|
|
162
|
+
* Fetch a specific content entry by slug
|
|
163
|
+
*/
|
|
164
|
+
getEntry(params: {
|
|
165
|
+
siteId: string;
|
|
166
|
+
contentType: string;
|
|
167
|
+
slug: string;
|
|
168
|
+
}): Promise<EntryResponse>;
|
|
169
|
+
/**
|
|
170
|
+
* Fetch a public form definition by ID
|
|
171
|
+
*/
|
|
172
|
+
getPublicFormById(params: {
|
|
173
|
+
formId: string;
|
|
174
|
+
}): Promise<PublicFormResponse>;
|
|
175
|
+
/**
|
|
176
|
+
* Fetch public booking services for a site
|
|
177
|
+
*/
|
|
178
|
+
getPublicBookingServices(params: {
|
|
179
|
+
siteId: string;
|
|
180
|
+
ids?: string;
|
|
181
|
+
}): Promise<PublicBookingServicesResponse>;
|
|
182
|
+
/**
|
|
183
|
+
* List public events for a site (optionally time-filtered)
|
|
184
|
+
*/
|
|
185
|
+
listPublicEvents(params: {
|
|
186
|
+
siteId: string;
|
|
187
|
+
limit?: number;
|
|
188
|
+
from?: string;
|
|
189
|
+
to?: string;
|
|
190
|
+
stage?: string;
|
|
191
|
+
}): Promise<PublicEventsResponse>;
|
|
192
|
+
/**
|
|
193
|
+
* Force clear the cache
|
|
194
|
+
*/
|
|
195
|
+
clearCache(): void;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
export type { EntriesResponse as E, PageResponse as P, RiverbankClient as R, SiteResponse as S, RiverbankClientConfig as a, EntryResponse as b, EntriesResponseWithMeta as c, PaginationMeta as d };
|