@riverbankcms/sdk 0.7.5 → 0.8.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.
Files changed (72) hide show
  1. package/README.md +88 -1
  2. package/dist/cli/index.js +3693 -39
  3. package/dist/cli/index.js.map +1 -1
  4. package/dist/client/client.d.mts +2 -2
  5. package/dist/client/client.d.ts +2 -2
  6. package/dist/client/client.js +105 -2
  7. package/dist/client/client.js.map +1 -1
  8. package/dist/client/client.mjs +105 -2
  9. package/dist/client/client.mjs.map +1 -1
  10. package/dist/client/hooks.d.mts +2 -2
  11. package/dist/client/hooks.d.ts +2 -2
  12. package/dist/client/usePage-CdnO2CP5.d.mts +6875 -0
  13. package/dist/client/usePage-_ksKXlUF.d.ts +6875 -0
  14. package/dist/server/{Layout-qWLdVm5-.d.mts → Layout-D4J009eS.d.mts} +1 -1
  15. package/dist/server/{Layout-Yluyb6sK.d.ts → Layout-l2v4Qa6E.d.ts} +1 -1
  16. package/dist/server/{chunk-2NBNOY3C.mjs → chunk-65A5HAUZ.mjs} +106 -3
  17. package/dist/server/chunk-65A5HAUZ.mjs.map +1 -0
  18. package/dist/server/{chunk-KH3EXBJM.js → chunk-WM646WI3.js} +106 -3
  19. package/dist/server/chunk-WM646WI3.js.map +1 -0
  20. package/dist/server/{components-Di5ME6He.d.ts → components-D2uCKCj7.d.ts} +3 -3
  21. package/dist/server/{components-DNHfSCML.d.mts → components-vtYEmmPF.d.mts} +3 -3
  22. package/dist/server/components.d.mts +5 -5
  23. package/dist/server/components.d.ts +5 -5
  24. package/dist/server/config-validation.d.mts +2 -2
  25. package/dist/server/config-validation.d.ts +2 -2
  26. package/dist/server/config.d.mts +3 -3
  27. package/dist/server/config.d.ts +3 -3
  28. package/dist/server/data.d.mts +2 -2
  29. package/dist/server/data.d.ts +2 -2
  30. package/dist/server/{index-Clm3skz_.d.mts → index-2qnY7VH_.d.mts} +1 -1
  31. package/dist/server/{index-DLvNddi-.d.ts → index-BxrAuL9K.d.ts} +1 -1
  32. package/dist/server/{index-C9Ra8dza.d.ts → index-CH_dvF6n.d.ts} +2 -2
  33. package/dist/server/{index--Oyunk_B.d.mts → index-DfWg1Qle.d.mts} +2 -2
  34. package/dist/server/index.d.mts +13 -5
  35. package/dist/server/index.d.ts +13 -5
  36. package/dist/server/index.js +10 -10
  37. package/dist/server/index.mjs +1 -1
  38. package/dist/server/{loadContent-D7LQwI0o.d.ts → loadContent-DECnsp4k.d.ts} +3 -3
  39. package/dist/server/{loadContent-DVfuBLiZ.d.mts → loadContent-Du5kS8UM.d.mts} +3 -3
  40. package/dist/server/{loadPage-BmYJCe_V.d.ts → loadPage-BZohBxxf.d.ts} +2 -2
  41. package/dist/server/{loadPage-BucnLHmE.d.mts → loadPage-VBorKlWv.d.mts} +2 -2
  42. package/dist/server/metadata.d.mts +4 -4
  43. package/dist/server/metadata.d.ts +4 -4
  44. package/dist/server/navigation.d.mts +2 -2
  45. package/dist/server/navigation.d.ts +2 -2
  46. package/dist/server/next.d.mts +38 -7
  47. package/dist/server/next.d.ts +38 -7
  48. package/dist/server/next.js +29 -11
  49. package/dist/server/next.js.map +1 -1
  50. package/dist/server/next.mjs +29 -11
  51. package/dist/server/next.mjs.map +1 -1
  52. package/dist/server/rendering/server.d.mts +4 -4
  53. package/dist/server/rendering/server.d.ts +4 -4
  54. package/dist/server/rendering.d.mts +7 -7
  55. package/dist/server/rendering.d.ts +7 -7
  56. package/dist/server/routing.d.mts +4 -4
  57. package/dist/server/routing.d.ts +4 -4
  58. package/dist/server/server.d.mts +5 -5
  59. package/dist/server/server.d.ts +5 -5
  60. package/dist/server/server.js +2 -2
  61. package/dist/server/server.mjs +1 -1
  62. package/dist/server/{types-C-LShyIg.d.mts → types-BRQ_6yOc.d.mts} +43 -1
  63. package/dist/server/{types-BjgZt8xJ.d.mts → types-CJfJwcuL.d.mts} +37 -0
  64. package/dist/server/{types-Dt98DeYa.d.ts → types-CgSO0yxg.d.ts} +8 -0
  65. package/dist/server/{types-BRQyLrQU.d.ts → types-D0rPF8l5.d.ts} +43 -1
  66. package/dist/server/{types-DLBhEPSt.d.ts → types-D8XqwoVd.d.ts} +37 -0
  67. package/dist/server/{types-BSV6Vc-P.d.mts → types-DT30Qy7x.d.mts} +8 -0
  68. package/dist/server/{validation-DU2YE7u5.d.ts → validation-D1LaY1kQ.d.ts} +1 -1
  69. package/dist/server/{validation-BGuRo8P1.d.mts → validation-Pv3Zs6dP.d.mts} +1 -1
  70. package/package.json +2 -1
  71. package/dist/server/chunk-2NBNOY3C.mjs.map +0 -1
  72. package/dist/server/chunk-KH3EXBJM.js.map +0 -1
@@ -1,10 +1,10 @@
1
- export { c as createRiverbankClient } from './index-DLvNddi-.js';
2
- export { E as EntriesResponse, b as EntryResponse, P as PageResponse, R as RiverbankClient, a as RiverbankClientConfig, S as SiteResponse } from './types-BRQyLrQU.js';
3
- export { L as LoadPageParams, a as LoadPageResult, R as RuntimeSdkConfig, l as loadPage } from './loadPage-BmYJCe_V.js';
4
- export { C as ContentEntryData, E as EntryContentResult, L as LoadContentParams, b as LoadContentResult, P as PageContentResult, a as isEntryContent, i as isPageContent, l as loadContent } from './loadContent-D7LQwI0o.js';
1
+ export { c as createRiverbankClient } from './index-BxrAuL9K.js';
2
+ export { E as EntriesResponse, b as EntryResponse, P as PageResponse, R as RiverbankClient, a as RiverbankClientConfig, S as SiteResponse } from './types-D0rPF8l5.js';
3
+ export { L as LoadPageParams, a as LoadPageResult, R as RuntimeSdkConfig, l as loadPage } from './loadPage-BZohBxxf.js';
4
+ export { C as ContentEntryData, E as EntryContentResult, L as LoadContentParams, b as LoadContentResult, P as PageContentResult, a as isEntryContent, i as isPageContent, l as loadContent } from './loadContent-DECnsp4k.js';
5
5
  import './schema-Z6-afHJG.js';
6
6
  import 'zod';
7
- import './types-Dt98DeYa.js';
7
+ import './types-CgSO0yxg.js';
8
8
  import '@riverbankcms/ai';
9
9
  import './link-DjxLyC82.js';
10
10
  import '@riverbankcms/media-storage-supabase';
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkKH3EXBJMjs = require('./chunk-KH3EXBJM.js');
3
+ var _chunkWM646WI3js = require('./chunk-WM646WI3.js');
4
4
 
5
5
 
6
6
  var _chunkP3NNN73Gjs = require('./chunk-P3NNN73G.js');
@@ -19,5 +19,5 @@ require('./chunk-4CV4JOE5.js');
19
19
 
20
20
 
21
21
 
22
- exports.createRiverbankClient = _chunkKH3EXBJMjs.createRiverbankClient; exports.isEntryContent = _chunkEIJ27EZQjs.isEntryContent; exports.isPageContent = _chunkEIJ27EZQjs.isPageContent; exports.loadContent = _chunkEIJ27EZQjs.loadContent; exports.loadPage = _chunkP3NNN73Gjs.loadPage;
22
+ exports.createRiverbankClient = _chunkWM646WI3js.createRiverbankClient; exports.isEntryContent = _chunkEIJ27EZQjs.isEntryContent; exports.isPageContent = _chunkEIJ27EZQjs.isPageContent; exports.loadContent = _chunkEIJ27EZQjs.loadContent; exports.loadPage = _chunkP3NNN73Gjs.loadPage;
23
23
  //# sourceMappingURL=server.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createRiverbankClient
3
- } from "./chunk-2NBNOY3C.mjs";
3
+ } from "./chunk-65A5HAUZ.mjs";
4
4
  import {
5
5
  loadPage
6
6
  } from "./chunk-C6FIJC7T.mjs";
@@ -1,4 +1,4 @@
1
- import { A as APIEndpoints } from './types-BSV6Vc-P.mjs';
1
+ import { A as APIEndpoints } from './types-DT30Qy7x.mjs';
2
2
  import './schema-Z6-afHJG.mjs';
3
3
 
4
4
  type SiteResponse = NonNullable<APIEndpoints['getSite']['response']>;
@@ -10,6 +10,7 @@ type PublicBookingServicesResponse = NonNullable<APIEndpoints['getPublicBookingS
10
10
  type PublicEventsResponse = NonNullable<APIEndpoints['listPublicEvents']['response']>;
11
11
  type ResolveEventOccurrenceResponse = NonNullable<APIEndpoints['resolveEventOccurrence']['response']>;
12
12
  type CheckRedirectResponse = NonNullable<APIEndpoints['checkRedirect']['response']>;
13
+ type RoutableContentResponse = NonNullable<APIEndpoints['getRoutableContent']['response']>;
13
14
  /**
14
15
  * Pagination metadata returned when `includeMeta: true`
15
16
  */
@@ -159,6 +160,13 @@ interface ResilienceConfig {
159
160
  /** Callback fired only when transitioning into/out of degraded mode */
160
161
  onDegradedMode?: (degraded: boolean, status: ResilienceStatus) => void;
161
162
  }
163
+ /**
164
+ * Type of API key based on prefix detection.
165
+ * - 'content': bld_live_sk_* or bld_test_sk_* (for published content)
166
+ * - 'preview': bld_preview_sk_* (for draft content)
167
+ * - 'unknown': Unrecognized prefix
168
+ */
169
+ type ApiKeyType = 'content' | 'preview' | 'unknown';
162
170
  /**
163
171
  * Configuration for creating a Riverbank CMS client
164
172
  */
@@ -351,10 +359,44 @@ interface RiverbankClient {
351
359
  siteId: string;
352
360
  path: string;
353
361
  } & SdkMethodOptions): Promise<CheckRedirectResponse>;
362
+ /**
363
+ * Get all published routes for a site.
364
+ * Useful for static site generation (SSG) to enumerate all pages.
365
+ *
366
+ * @param params.siteId - The site ID
367
+ *
368
+ * @example
369
+ * ```ts
370
+ * const routes = await client.getAllPublishedRoutes({ siteId: 'site-id' });
371
+ * // routes.items contains all published pages and content entries with routes
372
+ * ```
373
+ */
374
+ getAllPublishedRoutes(params: {
375
+ siteId: string;
376
+ } & SdkMethodOptions): Promise<RoutableContentResponse>;
354
377
  /**
355
378
  * Force clear the cache
356
379
  */
357
380
  clearCache(): void;
381
+ /**
382
+ * Get the detected API key type based on the key prefix.
383
+ *
384
+ * This allows SDK helpers like `createCatchAllPage` to automatically
385
+ * determine whether to fetch preview or published content based on
386
+ * which key the client was configured with.
387
+ *
388
+ * @returns The detected key type: 'content', 'preview', or 'unknown'
389
+ *
390
+ * @example
391
+ * ```ts
392
+ * const client = createRiverbankClient({ apiKey: 'bld_live_sk_...' });
393
+ * client.getKeyType(); // 'content'
394
+ *
395
+ * const previewClient = createRiverbankClient({ apiKey: 'bld_preview_sk_...' });
396
+ * previewClient.getKeyType(); // 'preview'
397
+ * ```
398
+ */
399
+ getKeyType(): ApiKeyType;
358
400
  /**
359
401
  * Get the status from the most recently emitted request
360
402
  *
@@ -503,6 +503,28 @@ interface SyncConfig {
503
503
  */
504
504
  contentTarget?: 'draft' | 'publish';
505
505
  }
506
+ /**
507
+ * Deploy command configuration for automated deployment workflow.
508
+ *
509
+ * The deploy command automates the full deploy workflow:
510
+ * 1. Run verification (if configured)
511
+ * 2. Generate prebuild cache
512
+ * 3. Commit cache changes
513
+ * 4. Push to remote
514
+ */
515
+ interface DeployConfig {
516
+ /**
517
+ * Command to run for verification before deploy.
518
+ * If not set, verification step is skipped with a warning.
519
+ * @example 'pnpm verify'
520
+ */
521
+ verifyCommand?: string;
522
+ /**
523
+ * Directory where prebuild cache is output.
524
+ * @default '.riverbank-cache'
525
+ */
526
+ prebuildOutput?: string;
527
+ }
506
528
  /**
507
529
  * Top-level SDK site configuration.
508
530
  *
@@ -673,6 +695,21 @@ interface RiverbankSiteConfig {
673
695
  * ```
674
696
  */
675
697
  sync?: SyncConfig;
698
+ /**
699
+ * Deploy command configuration.
700
+ *
701
+ * Configures the `riverbankcms deploy` command behavior for
702
+ * automated deployments with prebuild cache generation.
703
+ *
704
+ * @example
705
+ * ```typescript
706
+ * deploy: {
707
+ * verifyCommand: 'pnpm verify',
708
+ * prebuildOutput: '.riverbank-cache',
709
+ * }
710
+ * ```
711
+ */
712
+ deploy?: DeployConfig;
676
713
  }
677
714
 
678
715
  export type { BlockFieldConfig as B, ContentTypeConfig as C, EntryConfig as E, FieldSelectOption as F, NavigationMenuConfig as N, PageConfig as P, RiverbankSiteConfig as R, SiteStyleConfig as S, ContentConfig as a, SectionBackground as b, SectionOptionsConfig as c, ContainerOptionsConfig as d, SectionSpacing as e, ContainerMaxWidth as f, ContainerAlignment as g, SdkThemeConfig as h, SdkThemePalette as i, BlockFieldOptionsMap as j, BlockFieldExtension as k, BlockFieldExtensionsMap as l, BlockConfig as m, NavigationItemConfig as n, NavigationLinkType as o, SiteSettingsConfig as p, SyncConfig as q };
@@ -2871,6 +2871,14 @@ type APIEndpoints = {
2871
2871
  }>;
2872
2872
  getRoutableContent: APIEndpoint<never, {
2873
2873
  siteId: string;
2874
+ publishedOnly?: string;
2875
+ }, {
2876
+ items: RoutableContentItem[];
2877
+ }>;
2878
+ /** Public endpoint for SDK SSG - requires content API key */
2879
+ getPublicRoutableContent: APIEndpoint<never, {
2880
+ siteId: string;
2881
+ publishedOnly?: string;
2874
2882
  }, {
2875
2883
  items: RoutableContentItem[];
2876
2884
  }>;
@@ -1,4 +1,4 @@
1
- import { A as APIEndpoints } from './types-Dt98DeYa.js';
1
+ import { A as APIEndpoints } from './types-CgSO0yxg.js';
2
2
  import './schema-Z6-afHJG.js';
3
3
 
4
4
  type SiteResponse = NonNullable<APIEndpoints['getSite']['response']>;
@@ -10,6 +10,7 @@ type PublicBookingServicesResponse = NonNullable<APIEndpoints['getPublicBookingS
10
10
  type PublicEventsResponse = NonNullable<APIEndpoints['listPublicEvents']['response']>;
11
11
  type ResolveEventOccurrenceResponse = NonNullable<APIEndpoints['resolveEventOccurrence']['response']>;
12
12
  type CheckRedirectResponse = NonNullable<APIEndpoints['checkRedirect']['response']>;
13
+ type RoutableContentResponse = NonNullable<APIEndpoints['getRoutableContent']['response']>;
13
14
  /**
14
15
  * Pagination metadata returned when `includeMeta: true`
15
16
  */
@@ -159,6 +160,13 @@ interface ResilienceConfig {
159
160
  /** Callback fired only when transitioning into/out of degraded mode */
160
161
  onDegradedMode?: (degraded: boolean, status: ResilienceStatus) => void;
161
162
  }
163
+ /**
164
+ * Type of API key based on prefix detection.
165
+ * - 'content': bld_live_sk_* or bld_test_sk_* (for published content)
166
+ * - 'preview': bld_preview_sk_* (for draft content)
167
+ * - 'unknown': Unrecognized prefix
168
+ */
169
+ type ApiKeyType = 'content' | 'preview' | 'unknown';
162
170
  /**
163
171
  * Configuration for creating a Riverbank CMS client
164
172
  */
@@ -351,10 +359,44 @@ interface RiverbankClient {
351
359
  siteId: string;
352
360
  path: string;
353
361
  } & SdkMethodOptions): Promise<CheckRedirectResponse>;
362
+ /**
363
+ * Get all published routes for a site.
364
+ * Useful for static site generation (SSG) to enumerate all pages.
365
+ *
366
+ * @param params.siteId - The site ID
367
+ *
368
+ * @example
369
+ * ```ts
370
+ * const routes = await client.getAllPublishedRoutes({ siteId: 'site-id' });
371
+ * // routes.items contains all published pages and content entries with routes
372
+ * ```
373
+ */
374
+ getAllPublishedRoutes(params: {
375
+ siteId: string;
376
+ } & SdkMethodOptions): Promise<RoutableContentResponse>;
354
377
  /**
355
378
  * Force clear the cache
356
379
  */
357
380
  clearCache(): void;
381
+ /**
382
+ * Get the detected API key type based on the key prefix.
383
+ *
384
+ * This allows SDK helpers like `createCatchAllPage` to automatically
385
+ * determine whether to fetch preview or published content based on
386
+ * which key the client was configured with.
387
+ *
388
+ * @returns The detected key type: 'content', 'preview', or 'unknown'
389
+ *
390
+ * @example
391
+ * ```ts
392
+ * const client = createRiverbankClient({ apiKey: 'bld_live_sk_...' });
393
+ * client.getKeyType(); // 'content'
394
+ *
395
+ * const previewClient = createRiverbankClient({ apiKey: 'bld_preview_sk_...' });
396
+ * previewClient.getKeyType(); // 'preview'
397
+ * ```
398
+ */
399
+ getKeyType(): ApiKeyType;
358
400
  /**
359
401
  * Get the status from the most recently emitted request
360
402
  *
@@ -503,6 +503,28 @@ interface SyncConfig {
503
503
  */
504
504
  contentTarget?: 'draft' | 'publish';
505
505
  }
506
+ /**
507
+ * Deploy command configuration for automated deployment workflow.
508
+ *
509
+ * The deploy command automates the full deploy workflow:
510
+ * 1. Run verification (if configured)
511
+ * 2. Generate prebuild cache
512
+ * 3. Commit cache changes
513
+ * 4. Push to remote
514
+ */
515
+ interface DeployConfig {
516
+ /**
517
+ * Command to run for verification before deploy.
518
+ * If not set, verification step is skipped with a warning.
519
+ * @example 'pnpm verify'
520
+ */
521
+ verifyCommand?: string;
522
+ /**
523
+ * Directory where prebuild cache is output.
524
+ * @default '.riverbank-cache'
525
+ */
526
+ prebuildOutput?: string;
527
+ }
506
528
  /**
507
529
  * Top-level SDK site configuration.
508
530
  *
@@ -673,6 +695,21 @@ interface RiverbankSiteConfig {
673
695
  * ```
674
696
  */
675
697
  sync?: SyncConfig;
698
+ /**
699
+ * Deploy command configuration.
700
+ *
701
+ * Configures the `riverbankcms deploy` command behavior for
702
+ * automated deployments with prebuild cache generation.
703
+ *
704
+ * @example
705
+ * ```typescript
706
+ * deploy: {
707
+ * verifyCommand: 'pnpm verify',
708
+ * prebuildOutput: '.riverbank-cache',
709
+ * }
710
+ * ```
711
+ */
712
+ deploy?: DeployConfig;
676
713
  }
677
714
 
678
715
  export type { BlockFieldConfig as B, ContentTypeConfig as C, EntryConfig as E, FieldSelectOption as F, NavigationMenuConfig as N, PageConfig as P, RiverbankSiteConfig as R, SiteStyleConfig as S, ContentConfig as a, SectionBackground as b, SectionOptionsConfig as c, ContainerOptionsConfig as d, SectionSpacing as e, ContainerMaxWidth as f, ContainerAlignment as g, SdkThemeConfig as h, SdkThemePalette as i, BlockFieldOptionsMap as j, BlockFieldExtension as k, BlockFieldExtensionsMap as l, BlockConfig as m, NavigationItemConfig as n, NavigationLinkType as o, SiteSettingsConfig as p, SyncConfig as q };
@@ -2871,6 +2871,14 @@ type APIEndpoints = {
2871
2871
  }>;
2872
2872
  getRoutableContent: APIEndpoint<never, {
2873
2873
  siteId: string;
2874
+ publishedOnly?: string;
2875
+ }, {
2876
+ items: RoutableContentItem[];
2877
+ }>;
2878
+ /** Public endpoint for SDK SSG - requires content API key */
2879
+ getPublicRoutableContent: APIEndpoint<never, {
2880
+ siteId: string;
2881
+ publishedOnly?: string;
2874
2882
  }, {
2875
2883
  items: RoutableContentItem[];
2876
2884
  }>;
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { S as SdkCustomBlock } from './schema-Z6-afHJG.js';
3
- import { a as ContentConfig, C as ContentTypeConfig, R as RiverbankSiteConfig, j as BlockFieldOptionsMap, k as BlockFieldExtension, l as BlockFieldExtensionsMap, q as SyncConfig } from './types-DLBhEPSt.js';
3
+ import { a as ContentConfig, C as ContentTypeConfig, R as RiverbankSiteConfig, j as BlockFieldOptionsMap, k as BlockFieldExtension, l as BlockFieldExtensionsMap, q as SyncConfig } from './types-D8XqwoVd.js';
4
4
 
5
5
  /**
6
6
  * SDK Content Config Validation
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { S as SdkCustomBlock } from './schema-Z6-afHJG.mjs';
3
- import { a as ContentConfig, C as ContentTypeConfig, R as RiverbankSiteConfig, j as BlockFieldOptionsMap, k as BlockFieldExtension, l as BlockFieldExtensionsMap, q as SyncConfig } from './types-BjgZt8xJ.mjs';
3
+ import { a as ContentConfig, C as ContentTypeConfig, R as RiverbankSiteConfig, j as BlockFieldOptionsMap, k as BlockFieldExtension, l as BlockFieldExtensionsMap, q as SyncConfig } from './types-CJfJwcuL.mjs';
4
4
 
5
5
  /**
6
6
  * SDK Content Config Validation
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riverbankcms/sdk",
3
- "version": "0.7.5",
3
+ "version": "0.8.0",
4
4
  "description": "Riverbank CMS SDK for headless content consumption",
5
5
  "main": "./dist/server/index.js",
6
6
  "module": "./dist/server/index.mjs",
@@ -150,6 +150,7 @@
150
150
  "fast-deep-equal": "^3.1.3",
151
151
  "jiti": "^2.6.1",
152
152
  "prompts": "^2.4.2",
153
+ "simple-git": "^3.27.0",
153
154
  "zod": "^4.1.1"
154
155
  },
155
156
  "peerDependencies": {