@riverbankcms/sdk 0.88.0 → 0.89.1

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 (103) hide show
  1. package/dist/{PreviewEditorSidebar-EVRS3C7T.mjs → PreviewEditorSidebar-JDR64FEC.mjs} +3 -3
  2. package/dist/{PreviewEditorUI-54WD4IGE.mjs → PreviewEditorUI-67TMJMAF.mjs} +3 -3
  3. package/dist/SdkPreviewModeRuntime-ZBEMRV7N.mjs +8 -0
  4. package/dist/_dts/api/src/accessAdmin.d.ts +7 -0
  5. package/dist/_dts/api/src/endpoints.d.ts +8 -0
  6. package/dist/_dts/api/src/index.d.ts +2 -2
  7. package/dist/_dts/api/src/siteManagementEndpoints.d.ts +5 -1
  8. package/dist/_dts/api/src/siteMembers.d.ts +6 -1
  9. package/dist/_dts/api/src/types.d.ts +1 -1
  10. package/dist/_dts/blocks/src/system/icons/cta.d.ts +3 -3
  11. package/dist/_dts/blocks/src/system/icons/index.d.ts +1 -0
  12. package/dist/_dts/blocks/src/system/icons/registry.d.ts +2 -2
  13. package/dist/_dts/blocks/src/system/icons/semantic.d.ts +3 -3
  14. package/dist/_dts/blocks/src/system/icons/svg.d.ts +72 -0
  15. package/dist/_dts/blocks/src/system/runtime/api/types.d.ts +1 -0
  16. package/dist/_dts/blocks/src/system/runtime/hooks/loadStateError.d.ts +1 -0
  17. package/dist/_dts/blocks/src/system/runtime/hooks/useAvailableDates.d.ts +1 -1
  18. package/dist/_dts/blocks/src/system/runtime/hooks/useAvailableDates.state.d.ts +55 -0
  19. package/dist/_dts/blocks/src/system/runtime/hooks/useAvailableSlots.state.d.ts +39 -0
  20. package/dist/_dts/blocks/src/system/runtime/hooks/useBookingFormConfig.d.ts +4 -27
  21. package/dist/_dts/blocks/src/system/runtime/hooks/useBookingFormConfig.state.d.ts +40 -0
  22. package/dist/_dts/blocks/src/system/runtime/hooks/useCalendarEvents.state.d.ts +20 -0
  23. package/dist/_dts/blocks/src/system/runtime/hooks/useEventFilters.state.d.ts +31 -0
  24. package/dist/_dts/blocks/src/system/runtime/hooks/useEventPagination.d.ts +3 -3
  25. package/dist/_dts/blocks/src/system/runtime/hooks/useEventPagination.state.d.ts +39 -0
  26. package/dist/_dts/blocks/src/system/runtime/nodes/events/shared/EventPaginatedListView.client.d.ts +1 -1
  27. package/dist/_dts/blocks/src/system/runtime/nodes/newsletter-form.client.state.d.ts +24 -2
  28. package/dist/_dts/blocks/src/system/runtime/nodes/shared/MagicLinkForm.state.d.ts +24 -0
  29. package/dist/_dts/blocks/src/system/runtime/shared/useWaitlistClaim.state.d.ts +35 -0
  30. package/dist/_dts/content-model/src/entry-slots/types.d.ts +54 -0
  31. package/dist/_dts/core/src/branded.d.ts +7 -0
  32. package/dist/_dts/core/src/index.d.ts +1 -0
  33. package/dist/_dts/core/src/site-route-target.d.ts +40 -0
  34. package/dist/_dts/db/src/generated/supabase/database.types.d.ts +159 -2
  35. package/dist/_dts/media-core/src/fileDomain.d.ts +4 -0
  36. package/dist/_dts/sdk/src/client/runtimeCachePolicy.d.ts +160 -0
  37. package/dist/_dts/sdk/src/client/types.d.ts +26 -1
  38. package/dist/_dts/sdk/src/index.d.ts +3 -1
  39. package/dist/_dts/sdk/src/version.d.ts +1 -1
  40. package/dist/_dts/theme-core/src/generated/containerResponsiveThemeCss.d.ts +1 -1
  41. package/dist/{chunk-YDMBIIS5.mjs → chunk-7N46MZHI.mjs} +1 -1
  42. package/dist/{chunk-7KOO7RPP.mjs → chunk-7YUAXONX.mjs} +1007 -353
  43. package/dist/{chunk-O4LVYUVH.mjs → chunk-F645A5UV.mjs} +18 -0
  44. package/dist/{chunk-ER4UIW4X.mjs → chunk-HKJQERFR.mjs} +7 -7
  45. package/dist/{chunk-K3JWH6HE.mjs → chunk-TGBJWKMP.mjs} +1 -1
  46. package/dist/{chunk-HVOBXA3Y.mjs → chunk-ZQRBLCW5.mjs} +2 -2
  47. package/dist/cli/index.mjs +668 -18
  48. package/dist/client/{accordion-PT5CGW5N.mjs → accordion-MUCVNGQ7.mjs} +2 -2
  49. package/dist/client/{bookingForm-2HLRTEYS.mjs → bookingForm-PKD6EFIE.mjs} +192 -76
  50. package/dist/client/bookings.mjs +436 -191
  51. package/dist/client/{carousel-Z2LKYSWA.mjs → carousel-3TKQSNJC.mjs} +4 -3
  52. package/dist/client/{cart-ND5IK4A6.mjs → cart-6XHSZK23.mjs} +8 -7
  53. package/dist/client/{checkout-EYUSGAY7.mjs → checkout-FVSPM6FI.mjs} +8 -7
  54. package/dist/client/chunk-6N7YRNYU.mjs +183 -0
  55. package/dist/client/{chunk-O5JNI3E4.mjs → chunk-7DH35FGA.mjs} +2 -2
  56. package/dist/client/{chunk-BAWHZ5GM.mjs → chunk-CQKKFEQD.mjs} +195 -61
  57. package/dist/client/{chunk-X7GVFB7Y.mjs → chunk-EY42X22F.mjs} +3 -3
  58. package/dist/client/{chunk-6DVPO44G.mjs → chunk-FHU6PFPM.mjs} +1 -1
  59. package/dist/client/{chunk-H4MHEXYS.mjs → chunk-LQFDYWPJ.mjs} +1 -1
  60. package/dist/client/{chunk-MHBEWDT7.mjs → chunk-RSQWWUAD.mjs} +122 -50
  61. package/dist/client/{chunk-GOFO7HRH.mjs → chunk-STJ2NCQM.mjs} +1 -1
  62. package/dist/client/{chunk-DIRW2LNG.mjs → chunk-UQFY4AHX.mjs} +272 -198
  63. package/dist/client/{chunk-WCVK4MBJ.mjs → chunk-VGLXACVK.mjs} +1 -1
  64. package/dist/client/{chunk-BL66UWGD.mjs → chunk-ZJZZA5EP.mjs} +6 -6
  65. package/dist/client/{chunk-S4G65LGR.mjs → chunk-ZT5XE7FK.mjs} +1 -1
  66. package/dist/client/client.mjs +3823 -3507
  67. package/dist/client/{courseRegistration-H3AZBUEG.mjs → courseRegistration-ATZSYDHM.mjs} +6 -6
  68. package/dist/client/{eventCalendar-FPKJGLGS.mjs → eventCalendar-6T2UGKKP.mjs} +10 -9
  69. package/dist/client/{eventCombined-QCGIZBUY.mjs → eventCombined-Q4VANXVF.mjs} +10 -9
  70. package/dist/client/{eventDetails-HIT3BJWU.mjs → eventDetails-DW37E7VW.mjs} +10 -9
  71. package/dist/client/{eventListing-R4HNWJDN.mjs → eventListing-XURTSAUW.mjs} +10 -9
  72. package/dist/client/{eventRegistration-Q7BYY5HF.mjs → eventRegistration-MRKEVAXW.mjs} +10 -9
  73. package/dist/client/{form-NI6YOG6S.mjs → form-WZZFFGMU.mjs} +3 -3
  74. package/dist/client/{headerSection-SDYGII36.mjs → headerSection-EQYVQBLM.mjs} +3 -3
  75. package/dist/client/hooks.mjs +18 -0
  76. package/dist/client/{locationMap-BDETEUQD.mjs → locationMap-MFF5VAZR.mjs} +3 -3
  77. package/dist/client/{newsletterForm-EKYIU67X.mjs → newsletterForm-JQ77UYIE.mjs} +60 -24
  78. package/dist/client/{productDetail-5UTGNN76.mjs → productDetail-25LMT3IZ.mjs} +8 -7
  79. package/dist/client/{productList-7YA5KXZQ.mjs → productList-5ABEMKUG.mjs} +8 -7
  80. package/dist/client/rendering/client.mjs +3266 -3528
  81. package/dist/client/rendering/islands.mjs +19 -19
  82. package/dist/client/rendering.mjs +3143 -3452
  83. package/dist/client/{shop-AIMUMZYC.mjs → shop-OMMQZ6YO.mjs} +8 -7
  84. package/dist/preview-next/before-render.mjs +18 -0
  85. package/dist/preview-next/client/runtime.mjs +5 -5
  86. package/dist/preview-next/middleware.mjs +18 -0
  87. package/dist/{sdk-runtime-NW472WNT.mjs → sdk-runtime-WNLBZ3ZH.mjs} +6 -6
  88. package/dist/server/components.mjs +1068 -1540
  89. package/dist/server/config-validation.mjs +18 -0
  90. package/dist/server/config.mjs +18 -0
  91. package/dist/server/data.mjs +18 -0
  92. package/dist/server/index.mjs +847 -261
  93. package/dist/server/next.mjs +1708 -1555
  94. package/dist/server/prebuild.mjs +1 -1
  95. package/dist/server/rendering/server.mjs +1068 -1540
  96. package/dist/server/rendering.mjs +1074 -1546
  97. package/dist/server/routing.mjs +314 -9
  98. package/dist/server/server.mjs +668 -25
  99. package/dist/server/theme-bridge.mjs +26 -0
  100. package/dist/styles/index.css +26 -0
  101. package/package.json +2 -1
  102. package/dist/SdkPreviewModeRuntime-ZALZDJEK.mjs +0 -8
  103. /package/dist/client/{chunk-LI2C6M5O.mjs → chunk-25W2EQUN.mjs} +0 -0
@@ -527,6 +527,12 @@ var init_stable_json = __esm({
527
527
  }
528
528
  });
529
529
 
530
+ // ../core/src/site-route-target.ts
531
+ var init_site_route_target = __esm({
532
+ "../core/src/site-route-target.ts"() {
533
+ }
534
+ });
535
+
530
536
  // ../core/src/index.ts
531
537
  var init_src = __esm({
532
538
  "../core/src/index.ts"() {
@@ -573,6 +579,7 @@ var init_src = __esm({
573
579
  init_string();
574
580
  init_uuid();
575
581
  init_stable_json();
582
+ init_site_route_target();
576
583
  }
577
584
  });
578
585
 
@@ -23647,6 +23654,24 @@ var ENDPOINT_DEFINITIONS = {
23647
23654
  auth: "user",
23648
23655
  responseKind: "json"
23649
23656
  },
23657
+ resendSiteInvitation: {
23658
+ path: "/sites/{siteId}/members/invitations/{invitationId}/resend",
23659
+ method: "POST",
23660
+ errors: [
23661
+ "auth:forbidden",
23662
+ "resource:not_found",
23663
+ "validation:invalid_input",
23664
+ "external:service_error",
23665
+ "server:internal_error"
23666
+ ],
23667
+ tags: [
23668
+ "site-{siteId}",
23669
+ "site-members-{siteId}",
23670
+ "site-invite-{invitationId}"
23671
+ ],
23672
+ auth: "user",
23673
+ responseKind: "json"
23674
+ },
23650
23675
  transferSiteOwnership: {
23651
23676
  path: "/sites/{siteId}/members/transfer-ownership",
23652
23677
  method: "POST",
@@ -65171,7 +65196,7 @@ var SimpleCache = class {
65171
65196
  };
65172
65197
 
65173
65198
  // src/version.ts
65174
- var SDK_VERSION = "0.88.0";
65199
+ var SDK_VERSION = "0.89.1";
65175
65200
 
65176
65201
  // src/client/error.ts
65177
65202
  var RiverbankApiError = class _RiverbankApiError extends Error {
@@ -65328,6 +65353,476 @@ function attachResilienceStatusToError(error, resilienceStatus) {
65328
65353
  return target;
65329
65354
  }
65330
65355
 
65356
+ // src/public-api/runtime.ts
65357
+ var PUBLIC_ENDPOINT_NAMES2 = [
65358
+ "getSite",
65359
+ "getContentByPath",
65360
+ "listPublishedEntries",
65361
+ "getPublishedEntryPreview",
65362
+ "getPublicFormById",
65363
+ "listPublicForms",
65364
+ "getPublicBookingServices",
65365
+ "getPublicChallenge",
65366
+ "listPublicEvents",
65367
+ "batchBlockLoaders",
65368
+ "listPublicCourses",
65369
+ "listPublicTeamMembers",
65370
+ "listPublicProducts",
65371
+ "listPublicPasses",
65372
+ "listPublicMemberships",
65373
+ "resolveEntrySubroute",
65374
+ "resolveEventOccurrence",
65375
+ "checkRedirect",
65376
+ "getRoutableContent",
65377
+ "getPublicRoutableContent",
65378
+ "getPublicSitemapRoutes"
65379
+ ];
65380
+ var API_ENDPOINTS2 = Object.freeze({
65381
+ getSite: {
65382
+ path: "/sites",
65383
+ method: "GET",
65384
+ revalidate: 900,
65385
+ tags: ["riverbank:site", "riverbank:site:id:{id}", "riverbank:site:slug:{slug}", "riverbank:site:domain:{domain}"],
65386
+ auth: "public",
65387
+ responseKind: "json"
65388
+ },
65389
+ getContentByPath: {
65390
+ path: "/sites/{siteId}/pages",
65391
+ method: "GET",
65392
+ tags: ["riverbank:site:{siteId}:routable-content"],
65393
+ auth: "public",
65394
+ responseKind: "json"
65395
+ },
65396
+ listPublishedEntries: {
65397
+ path: "/public/content/{siteId}/{type}/entries",
65398
+ method: "GET",
65399
+ revalidate: 60,
65400
+ tags: ["content-{siteId}-{type}"],
65401
+ auth: "public",
65402
+ responseKind: "json"
65403
+ },
65404
+ getPublishedEntryPreview: {
65405
+ path: "/public/content/{siteId}/{type}/{slug}/preview",
65406
+ method: "GET",
65407
+ revalidate: 60,
65408
+ tags: ["content-{siteId}-{type}-{slug}"],
65409
+ auth: "public",
65410
+ responseKind: "json"
65411
+ },
65412
+ getPublicFormById: {
65413
+ path: "/public/forms/{formId}",
65414
+ method: "GET",
65415
+ revalidate: 60,
65416
+ tags: ["riverbank:form:{formId}"],
65417
+ auth: "public",
65418
+ responseKind: "json"
65419
+ },
65420
+ listPublicForms: {
65421
+ path: "/public/sites/{siteId}/forms",
65422
+ method: "GET",
65423
+ revalidate: 60,
65424
+ tags: ["riverbank:site:{siteId}:forms"],
65425
+ auth: "public",
65426
+ responseKind: "json"
65427
+ },
65428
+ getPublicBookingServices: {
65429
+ path: "/public/bookings/services",
65430
+ method: "GET",
65431
+ revalidate: 60,
65432
+ tags: ["site-{siteId}"],
65433
+ auth: "public",
65434
+ responseKind: "json"
65435
+ },
65436
+ getPublicChallenge: {
65437
+ path: "/public/challenge",
65438
+ method: "GET",
65439
+ auth: "public",
65440
+ responseKind: "text"
65441
+ },
65442
+ listPublicEvents: {
65443
+ path: "/public/sites/{siteId}/events",
65444
+ method: "GET",
65445
+ revalidate: 60,
65446
+ tags: ["riverbank:site:{siteId}:public-events"],
65447
+ auth: "public",
65448
+ responseKind: "json"
65449
+ },
65450
+ batchBlockLoaders: {
65451
+ path: "/public/sites/{siteId}/block-loaders/batch",
65452
+ method: "POST",
65453
+ auth: "public",
65454
+ responseKind: "json"
65455
+ },
65456
+ listPublicCourses: {
65457
+ path: "/public/sites/{siteId}/courses",
65458
+ method: "GET",
65459
+ revalidate: 60,
65460
+ tags: ["riverbank:site:{siteId}:public-courses"],
65461
+ auth: "public",
65462
+ responseKind: "json"
65463
+ },
65464
+ listPublicTeamMembers: {
65465
+ path: "/public/sites/{siteId}/team-members",
65466
+ method: "GET",
65467
+ revalidate: 60,
65468
+ tags: ["riverbank:site:{siteId}:public-team-members"],
65469
+ auth: "public",
65470
+ responseKind: "json"
65471
+ },
65472
+ listPublicProducts: {
65473
+ path: "/public/sites/{siteId}/products",
65474
+ method: "GET",
65475
+ revalidate: 300,
65476
+ tags: ["riverbank:site:{siteId}:public-products"],
65477
+ auth: "public",
65478
+ responseKind: "json"
65479
+ },
65480
+ listPublicPasses: {
65481
+ path: "/public/sites/{siteId}/bookings/products/passes",
65482
+ method: "GET",
65483
+ revalidate: 300,
65484
+ tags: ["riverbank:site:{siteId}:public-passes"],
65485
+ auth: "public",
65486
+ responseKind: "json"
65487
+ },
65488
+ listPublicMemberships: {
65489
+ path: "/public/sites/{siteId}/bookings/products/memberships",
65490
+ method: "GET",
65491
+ revalidate: 300,
65492
+ tags: ["riverbank:site:{siteId}:public-memberships"],
65493
+ auth: "public",
65494
+ responseKind: "json"
65495
+ },
65496
+ resolveEntrySubroute: {
65497
+ path: "/public/sites/{siteId}/routing/subroutes/resolve",
65498
+ method: "GET",
65499
+ revalidate: 60,
65500
+ tags: ["site-{siteId}", "entry-subroute"],
65501
+ auth: "public",
65502
+ responseKind: "json"
65503
+ },
65504
+ resolveEventOccurrence: {
65505
+ path: "/public/sites/{siteId}/events/occurrences/resolve",
65506
+ method: "GET",
65507
+ revalidate: 60,
65508
+ tags: ["riverbank:site:{siteId}:public-events", "event-occurrence"],
65509
+ auth: "public",
65510
+ responseKind: "json"
65511
+ },
65512
+ checkRedirect: {
65513
+ path: "/public/content/redirect",
65514
+ method: "GET",
65515
+ revalidate: 86400,
65516
+ tags: ["redirect"],
65517
+ auth: "public",
65518
+ responseKind: "json"
65519
+ },
65520
+ getRoutableContent: {
65521
+ path: "/sites/{siteId}/routable-content",
65522
+ method: "GET",
65523
+ revalidate: 60,
65524
+ tags: ["riverbank:site:{siteId}:routable-content"],
65525
+ auth: "user",
65526
+ responseKind: "json"
65527
+ },
65528
+ getPublicRoutableContent: {
65529
+ path: "/public/sites/{siteId}/routable-content",
65530
+ method: "GET",
65531
+ revalidate: 60,
65532
+ tags: ["riverbank:site:{siteId}:routable-content"],
65533
+ auth: "public",
65534
+ responseKind: "json"
65535
+ },
65536
+ getPublicSitemapRoutes: {
65537
+ path: "/public/sites/{siteId}/sitemap",
65538
+ method: "GET",
65539
+ revalidate: 60,
65540
+ tags: ["riverbank:site:{siteId}:routable-content", "riverbank:site:{siteId}:settings"],
65541
+ auth: "public",
65542
+ responseKind: "json"
65543
+ }
65544
+ });
65545
+
65546
+ // src/client/runtimeCachePolicy.ts
65547
+ var DEFAULT_PUBLISHED_RUNTIME_CACHE_PAYLOAD_SCHEMA_VERSION = 1;
65548
+ var DEFAULT_STALE_TTL_SEC = 24 * 60 * 60;
65549
+ var DEFAULT_MEMORY_TTL_SEC = 60;
65550
+ var RUNTIME_CACHE_DURABILITY_OVERRIDES = {
65551
+ getSite: {
65552
+ kind: "durable-public-stale",
65553
+ staleTtlSec: DEFAULT_STALE_TTL_SEC
65554
+ },
65555
+ getContentByPath: {
65556
+ kind: "durable-public-stale",
65557
+ staleTtlSec: DEFAULT_STALE_TTL_SEC
65558
+ },
65559
+ listPublishedEntries: {
65560
+ kind: "memory-only",
65561
+ reason: "durable_rollout_pending"
65562
+ },
65563
+ getPublishedEntryPreview: {
65564
+ kind: "memory-only",
65565
+ reason: "durable_rollout_pending"
65566
+ },
65567
+ getPublicFormById: {
65568
+ kind: "memory-only",
65569
+ reason: "durable_rollout_pending"
65570
+ },
65571
+ listPublicForms: {
65572
+ kind: "memory-only",
65573
+ reason: "durable_rollout_pending"
65574
+ },
65575
+ getPublicBookingServices: {
65576
+ kind: "live-only",
65577
+ reason: "safety_sensitive_booking"
65578
+ },
65579
+ getPublicChallenge: {
65580
+ kind: "live-only",
65581
+ reason: "challenge_endpoint"
65582
+ },
65583
+ listPublicEvents: {
65584
+ kind: "memory-only",
65585
+ reason: "durable_rollout_pending"
65586
+ },
65587
+ batchBlockLoaders: {
65588
+ kind: "live-only",
65589
+ reason: "opaque_batch_loader"
65590
+ },
65591
+ listPublicCourses: {
65592
+ kind: "memory-only",
65593
+ reason: "durable_rollout_pending"
65594
+ },
65595
+ listPublicTeamMembers: {
65596
+ kind: "memory-only",
65597
+ reason: "durable_rollout_pending"
65598
+ },
65599
+ listPublicProducts: {
65600
+ kind: "memory-only",
65601
+ reason: "durable_rollout_pending"
65602
+ },
65603
+ listPublicPasses: {
65604
+ kind: "live-only",
65605
+ reason: "safety_sensitive_booking"
65606
+ },
65607
+ listPublicMemberships: {
65608
+ kind: "live-only",
65609
+ reason: "safety_sensitive_booking"
65610
+ },
65611
+ resolveEntrySubroute: {
65612
+ kind: "memory-only",
65613
+ reason: "durable_rollout_pending"
65614
+ },
65615
+ resolveEventOccurrence: {
65616
+ kind: "memory-only",
65617
+ reason: "durable_rollout_pending"
65618
+ },
65619
+ checkRedirect: {
65620
+ kind: "memory-only",
65621
+ reason: "durable_rollout_pending"
65622
+ },
65623
+ getRoutableContent: {
65624
+ kind: "live-only",
65625
+ reason: "auth_required"
65626
+ },
65627
+ getPublicRoutableContent: {
65628
+ kind: "memory-only",
65629
+ reason: "durable_rollout_pending"
65630
+ },
65631
+ getPublicSitemapRoutes: {
65632
+ kind: "memory-only",
65633
+ reason: "durable_rollout_pending"
65634
+ }
65635
+ };
65636
+ var PUBLIC_ENDPOINT_NAME_SET = new Set(PUBLIC_ENDPOINT_NAMES2);
65637
+ function isPublicEndpointName(endpoint) {
65638
+ return PUBLIC_ENDPOINT_NAME_SET.has(endpoint);
65639
+ }
65640
+ function isTruthyParam(value) {
65641
+ return value === true || value === "true" || value === 1 || value === "1";
65642
+ }
65643
+ function isPreviewRequest(endpoint, params) {
65644
+ if (endpoint === "getContentByPath") {
65645
+ return isTruthyParam(params.preview);
65646
+ }
65647
+ if (endpoint === "listPublishedEntries" || endpoint === "resolveEntrySubroute" || endpoint === "resolveEventOccurrence") {
65648
+ return params.stage === "preview";
65649
+ }
65650
+ return false;
65651
+ }
65652
+ function getEndpointFreshTtlSec(endpoint) {
65653
+ return API_ENDPOINTS2[endpoint].revalidate ?? DEFAULT_MEMORY_TTL_SEC;
65654
+ }
65655
+ function assertNever5(value) {
65656
+ throw new Error(`Unhandled runtime cache policy override: ${String(value)}`);
65657
+ }
65658
+ function resolveKnownEndpointPolicy(endpoint, params) {
65659
+ if (isPreviewRequest(endpoint, params)) {
65660
+ return { kind: "live-only", endpoint, reason: "preview_request" };
65661
+ }
65662
+ if (endpoint === "getSite" && isTruthyParam(params.force)) {
65663
+ return { kind: "live-only", endpoint, reason: "force_refresh" };
65664
+ }
65665
+ const override = RUNTIME_CACHE_DURABILITY_OVERRIDES[endpoint];
65666
+ if (override.kind === "live-only") {
65667
+ return { kind: "live-only", endpoint, reason: override.reason };
65668
+ }
65669
+ const endpointDefinition = API_ENDPOINTS2[endpoint];
65670
+ if (endpointDefinition.method !== "GET") {
65671
+ return { kind: "live-only", endpoint, reason: "non_get_request" };
65672
+ }
65673
+ if (endpointDefinition.auth === "user") {
65674
+ return { kind: "live-only", endpoint, reason: "auth_required" };
65675
+ }
65676
+ switch (override.kind) {
65677
+ case "durable-public-stale":
65678
+ return {
65679
+ kind: "durable-public-stale",
65680
+ endpoint,
65681
+ freshTtlSec: getEndpointFreshTtlSec(endpoint),
65682
+ staleTtlSec: override.staleTtlSec
65683
+ };
65684
+ case "memory-only":
65685
+ return {
65686
+ kind: "memory-only",
65687
+ endpoint,
65688
+ freshTtlSec: getEndpointFreshTtlSec(endpoint),
65689
+ reason: override.reason
65690
+ };
65691
+ default:
65692
+ return assertNever5(override);
65693
+ }
65694
+ }
65695
+ function resolveRuntimeCachePolicy(input) {
65696
+ if (input.method && input.method.toUpperCase() !== "GET") {
65697
+ return {
65698
+ kind: "live-only",
65699
+ endpoint: input.endpoint,
65700
+ reason: "non_get_request"
65701
+ };
65702
+ }
65703
+ if (!isPublicEndpointName(input.endpoint)) {
65704
+ return {
65705
+ kind: "live-only",
65706
+ endpoint: input.endpoint,
65707
+ reason: "unknown_endpoint"
65708
+ };
65709
+ }
65710
+ return resolveKnownEndpointPolicy(input.endpoint, input.params ?? {});
65711
+ }
65712
+ function toNonEmptyString(value) {
65713
+ if (value === null || value === void 0) return null;
65714
+ if (typeof value !== "string" && typeof value !== "number" && typeof value !== "boolean") {
65715
+ return null;
65716
+ }
65717
+ const normalized = String(value).trim();
65718
+ return normalized.length > 0 ? normalized : null;
65719
+ }
65720
+ function normalizeRuntimePublicPath(value) {
65721
+ const raw = toNonEmptyString(value) ?? "/";
65722
+ const withoutQuery = raw.split(/[?#]/, 1)[0] ?? "/";
65723
+ const withLeadingSlash = withoutQuery.startsWith("/") ? withoutQuery : `/${withoutQuery}`;
65724
+ const collapsed = withLeadingSlash.replace(/\/{2,}/g, "/");
65725
+ const withoutTrailingSlash = collapsed.length > 1 ? collapsed.replace(/\/+$/g, "") : collapsed;
65726
+ return withoutTrailingSlash || "/";
65727
+ }
65728
+ function normalizeRuntimeHostname(value) {
65729
+ const trimmed = value.trim().toLowerCase();
65730
+ const url = /^[a-z][a-z0-9+.-]*:\/\//.test(trimmed) ? new URL(trimmed) : new URL(`http://${trimmed}`);
65731
+ return url.hostname.replace(/\.$/, "");
65732
+ }
65733
+ function normalizeScalar(value) {
65734
+ return value.trim().toLowerCase();
65735
+ }
65736
+ function encodeKeyPart(key, value) {
65737
+ return `${encodeURIComponent(key)}=${encodeURIComponent(value)}`;
65738
+ }
65739
+ function unsafeAsPublishedRuntimeCacheKey(value) {
65740
+ return value;
65741
+ }
65742
+ function buildPublishedRuntimeCacheKey(endpoint, normalizedParams) {
65743
+ const encodedParams = Object.entries(normalizedParams).sort(([left], [right]) => left.localeCompare(right)).map(([key, value]) => encodeKeyPart(key, value)).join(":");
65744
+ return unsafeAsPublishedRuntimeCacheKey(
65745
+ `published-runtime:v1:${endpoint}:${encodedParams}`
65746
+ );
65747
+ }
65748
+ function selectSiteRuntimeIdentity(params) {
65749
+ const slug = toNonEmptyString(params.slug);
65750
+ if (slug !== null) return { slug: normalizeScalar(slug) };
65751
+ const domain = toNonEmptyString(params.domain);
65752
+ if (domain !== null) return { domain: normalizeRuntimeHostname(domain) };
65753
+ const id = toNonEmptyString(params.id);
65754
+ if (id !== null) return { id: normalizeScalar(id) };
65755
+ return null;
65756
+ }
65757
+ function deriveGetSiteKey(params) {
65758
+ const identity = selectSiteRuntimeIdentity(params);
65759
+ if (identity === null) {
65760
+ return {
65761
+ ok: false,
65762
+ error: {
65763
+ kind: "missing_site_identity",
65764
+ acceptedParams: ["slug", "domain", "id"]
65765
+ }
65766
+ };
65767
+ }
65768
+ const normalizedParams = {
65769
+ ...identity,
65770
+ currentPath: normalizeRuntimePublicPath(params.currentPath)
65771
+ };
65772
+ return {
65773
+ ok: true,
65774
+ endpoint: "getSite",
65775
+ key: buildPublishedRuntimeCacheKey("getSite", normalizedParams),
65776
+ normalizedParams
65777
+ };
65778
+ }
65779
+ function deriveGetContentByPathKey(params) {
65780
+ const siteId = toNonEmptyString(params.siteId);
65781
+ if (siteId === null) {
65782
+ return {
65783
+ ok: false,
65784
+ error: {
65785
+ kind: "missing_required_param",
65786
+ endpoint: "getContentByPath",
65787
+ param: "siteId"
65788
+ }
65789
+ };
65790
+ }
65791
+ const normalizedParams = {
65792
+ siteId: normalizeScalar(siteId),
65793
+ path: normalizeRuntimePublicPath(params.path)
65794
+ };
65795
+ return {
65796
+ ok: true,
65797
+ endpoint: "getContentByPath",
65798
+ key: buildPublishedRuntimeCacheKey("getContentByPath", normalizedParams),
65799
+ normalizedParams
65800
+ };
65801
+ }
65802
+ var DURABLE_RUNTIME_CACHE_KEY_DERIVERS = {
65803
+ getSite: deriveGetSiteKey,
65804
+ getContentByPath: deriveGetContentByPathKey
65805
+ };
65806
+ function derivePublishedRuntimeCacheKey(input) {
65807
+ const policy = resolveRuntimeCachePolicy({
65808
+ endpoint: input.endpoint,
65809
+ method: "GET",
65810
+ params: input.params
65811
+ });
65812
+ if (policy.kind !== "durable-public-stale") {
65813
+ return {
65814
+ ok: false,
65815
+ error: { kind: "not_durable_eligible", policy }
65816
+ };
65817
+ }
65818
+ switch (input.endpoint) {
65819
+ case "getSite":
65820
+ return DURABLE_RUNTIME_CACHE_KEY_DERIVERS.getSite(input.params);
65821
+ case "getContentByPath":
65822
+ return DURABLE_RUNTIME_CACHE_KEY_DERIVERS.getContentByPath(input.params);
65823
+ }
65824
+ }
65825
+
65331
65826
  // src/client/resilience.ts
65332
65827
  var DEFAULT_RETRY_CONFIG2 = {
65333
65828
  maxAttempts: 3,
@@ -65637,12 +66132,57 @@ setSdkVersion(SDK_VERSION);
65637
66132
  var DEFAULT_BROWSER_TIMEOUT_MS = 5e3;
65638
66133
  var DEFAULT_SERVER_TIMEOUT_MS = 8e3;
65639
66134
  var MAX_GET_ENTRIES_BY_IDENTIFIERS_REFS = 50;
66135
+ function isDurableRuntimeCacheTier(cacheTier) {
66136
+ return cacheTier === "durable-fresh" || cacheTier === "durable-stale";
66137
+ }
66138
+ function isDegradedResilienceStatus(source, details) {
66139
+ return source === "stale" || source === "error" || isDurableRuntimeCacheTier(details.cacheTier) && details.error !== void 0;
66140
+ }
65640
66141
  function generateRequestId2() {
65641
66142
  return `req-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
65642
66143
  }
65643
66144
  function toRecord(value) {
65644
66145
  return value && typeof value === "object" && !Array.isArray(value) ? value : {};
65645
66146
  }
66147
+ function getRuntimePayloadSiteId(value) {
66148
+ const site = toRecord(value).site;
66149
+ if (!site || typeof site !== "object" || Array.isArray(site)) {
66150
+ return null;
66151
+ }
66152
+ const id = site.id;
66153
+ return typeof id === "string" && id.trim().length > 0 ? id : null;
66154
+ }
66155
+ function getRiverbankErrorInfo(error) {
66156
+ if (error instanceof RiverbankApiError) {
66157
+ return { code: error.code, message: error.message, status: error.status };
66158
+ }
66159
+ if (error instanceof Error) {
66160
+ return { message: error.message };
66161
+ }
66162
+ return { message: String(error) };
66163
+ }
66164
+ function planPublishedRuntimeCache(input) {
66165
+ const policy = resolveRuntimeCachePolicy({
66166
+ endpoint: input.endpoint,
66167
+ method: "GET",
66168
+ params: input.params
66169
+ });
66170
+ if (policy.kind !== "durable-public-stale") {
66171
+ return null;
66172
+ }
66173
+ const keyResult = derivePublishedRuntimeCacheKey(input);
66174
+ if (!keyResult.ok) {
66175
+ return null;
66176
+ }
66177
+ return {
66178
+ cacheKey: keyResult.key,
66179
+ endpoint: keyResult.endpoint,
66180
+ normalizedParams: keyResult.normalizedParams,
66181
+ freshTtlSec: policy.freshTtlSec,
66182
+ staleTtlSec: policy.staleTtlSec,
66183
+ siteId: input.siteId ?? null
66184
+ };
66185
+ }
65646
66186
  function normalizeEntryIdentifierRefs(identifiers) {
65647
66187
  const trimmed = identifiers.map((identifier) => identifier.trim()).filter((identifier) => identifier.length > 0);
65648
66188
  if (trimmed.length === 0) {
@@ -65876,6 +66416,8 @@ function createRiverbankClient(config2) {
65876
66416
  source,
65877
66417
  isPreview: details.isPreview,
65878
66418
  cacheKey: details.cacheKey,
66419
+ cacheTier: details.cacheTier,
66420
+ durableCache: details.durableCache,
65879
66421
  error: details.error,
65880
66422
  staleAgeSec: details.staleAgeSec,
65881
66423
  prebuildAgeSec: details.prebuildAgeSec,
@@ -65885,7 +66427,7 @@ function createRiverbankClient(config2) {
65885
66427
  };
65886
66428
  lastStatus = status;
65887
66429
  config2.resilience?.onStatusChange?.(status);
65888
- const nowDegraded = source === "stale" || source === "error";
66430
+ const nowDegraded = isDegradedResilienceStatus(source, details);
65889
66431
  if (nowDegraded !== isDegraded) {
65890
66432
  isDegraded = nowDegraded;
65891
66433
  config2.resilience?.onDegradedMode?.(nowDegraded, status);
@@ -65895,6 +66437,80 @@ function createRiverbankClient(config2) {
65895
66437
  resilience: status
65896
66438
  };
65897
66439
  }
66440
+ async function tryPublishedRuntimeCacheFallback(plan, statusDetails, errorInfo) {
66441
+ const reader = config2.publishedRuntimeCache?.read;
66442
+ if (!plan || !reader) {
66443
+ return null;
66444
+ }
66445
+ try {
66446
+ const result = await reader({
66447
+ cacheKey: plan.cacheKey,
66448
+ endpoint: plan.endpoint,
66449
+ payloadSchemaVersion: DEFAULT_PUBLISHED_RUNTIME_CACHE_PAYLOAD_SCHEMA_VERSION
66450
+ });
66451
+ if (result.kind === "miss") {
66452
+ return {
66453
+ kind: "miss",
66454
+ diagnostic: {
66455
+ outcome: "miss",
66456
+ reason: result.reason
66457
+ }
66458
+ };
66459
+ }
66460
+ if (result.kind === "error") {
66461
+ return {
66462
+ kind: "error",
66463
+ diagnostic: {
66464
+ outcome: "error",
66465
+ error: result.error
66466
+ }
66467
+ };
66468
+ }
66469
+ return {
66470
+ kind: "hit",
66471
+ result: emitStatus(
66472
+ result.freshness === "fresh" ? "cache" : "stale",
66473
+ result.payload,
66474
+ statusDetails({
66475
+ error: errorInfo,
66476
+ staleAgeSec: result.staleAgeSec,
66477
+ cacheTier: result.freshness === "fresh" ? "durable-fresh" : "durable-stale"
66478
+ })
66479
+ )
66480
+ };
66481
+ } catch (error) {
66482
+ return {
66483
+ kind: "error",
66484
+ diagnostic: {
66485
+ outcome: "error",
66486
+ error: {
66487
+ kind: "adapter_exception",
66488
+ message: error instanceof Error ? error.message : String(error)
66489
+ }
66490
+ }
66491
+ };
66492
+ }
66493
+ }
66494
+ async function writePublishedRuntimeCache(plan, payload) {
66495
+ const writer = config2.publishedRuntimeCache?.write;
66496
+ if (!plan || !writer) {
66497
+ return;
66498
+ }
66499
+ try {
66500
+ await writer({
66501
+ cacheKey: plan.cacheKey,
66502
+ endpoint: plan.endpoint,
66503
+ normalizedParams: plan.normalizedParams,
66504
+ payload,
66505
+ siteId: plan.siteId ?? getRuntimePayloadSiteId(payload),
66506
+ freshTtlSec: plan.freshTtlSec,
66507
+ staleTtlSec: plan.staleTtlSec,
66508
+ payloadSchemaVersion: DEFAULT_PUBLISHED_RUNTIME_CACHE_PAYLOAD_SCHEMA_VERSION,
66509
+ writeReason: "live_success"
66510
+ });
66511
+ } catch {
66512
+ }
66513
+ }
65898
66514
  async function resilientFetch(cacheKey, fetcher, options) {
65899
66515
  const requestId = generateRequestId2();
65900
66516
  const startTime = Date.now();
@@ -65910,7 +66526,11 @@ function createRiverbankClient(config2) {
65910
66526
  if (cacheEnabled && !options.force) {
65911
66527
  const fresh = cache.getFresh(cacheKey);
65912
66528
  if (fresh !== null) {
65913
- return emitStatus("cache", fresh, statusDetails());
66529
+ return emitStatus(
66530
+ "cache",
66531
+ fresh,
66532
+ statusDetails({ cacheTier: "memory-fresh" })
66533
+ );
65914
66534
  }
65915
66535
  }
65916
66536
  if (resilienceEnabled && circuitBreaker.isOpen()) {
@@ -65922,6 +66542,7 @@ function createRiverbankClient(config2) {
65922
66542
  stale.value,
65923
66543
  statusDetails({
65924
66544
  staleAgeSec: stale.staleAgeSec,
66545
+ cacheTier: "memory-stale",
65925
66546
  error: {
65926
66547
  code: "circuit_open",
65927
66548
  message: "Circuit breaker is open"
@@ -65930,6 +66551,15 @@ function createRiverbankClient(config2) {
65930
66551
  );
65931
66552
  }
65932
66553
  }
66554
+ const durableFallback = allowFallbacks && !isPreview ? await tryPublishedRuntimeCacheFallback(
66555
+ options.publishedRuntimeCache,
66556
+ statusDetails,
66557
+ { code: "circuit_open", message: "Circuit breaker is open" }
66558
+ ) : null;
66559
+ const durableCache = durableFallback?.kind === "miss" || durableFallback?.kind === "error" ? durableFallback.diagnostic : void 0;
66560
+ if (durableFallback?.kind === "hit") {
66561
+ return durableFallback.result;
66562
+ }
65933
66563
  if (allowFallbacks && !isPreview && options.prebuildFallback) {
65934
66564
  const prebuildResult = options.prebuildFallback();
65935
66565
  if (prebuildResult) {
@@ -65938,6 +66568,8 @@ function createRiverbankClient(config2) {
65938
66568
  prebuildResult.data,
65939
66569
  statusDetails({
65940
66570
  prebuildAgeSec: prebuildResult.prebuildAgeSec,
66571
+ cacheTier: "prebuild",
66572
+ durableCache,
65941
66573
  error: {
65942
66574
  code: "circuit_open",
65943
66575
  message: "Circuit breaker is open"
@@ -65951,6 +66583,7 @@ function createRiverbankClient(config2) {
65951
66583
  "error",
65952
66584
  null,
65953
66585
  statusDetails({
66586
+ durableCache,
65954
66587
  error: { code: "circuit_open", message: "Circuit breaker is open" }
65955
66588
  })
65956
66589
  );
@@ -65991,6 +66624,9 @@ function createRiverbankClient(config2) {
65991
66624
  if (cacheEnabled) {
65992
66625
  cache.set(cacheKey, data);
65993
66626
  }
66627
+ if (allowFallbacks && !isPreview) {
66628
+ await writePublishedRuntimeCache(options.publishedRuntimeCache, data);
66629
+ }
65994
66630
  return emitStatus("live", data, statusDetails());
65995
66631
  } catch (error) {
65996
66632
  if (resilienceEnabled && error instanceof Error) {
@@ -65999,44 +66635,47 @@ function createRiverbankClient(config2) {
65999
66635
  if (allowFallbacks && !isPreview && staleIfError && cacheEnabled) {
66000
66636
  const stale = cache.getStale(cacheKey);
66001
66637
  if (stale) {
66002
- const errorInfo2 = error instanceof RiverbankApiError ? {
66003
- code: error.code,
66004
- message: error.message,
66005
- status: error.status
66006
- } : { message: error.message };
66638
+ const errorInfo2 = getRiverbankErrorInfo(error);
66007
66639
  return emitStatus(
66008
66640
  "stale",
66009
66641
  stale.value,
66010
66642
  statusDetails({
66011
66643
  staleAgeSec: stale.staleAgeSec,
66644
+ cacheTier: "memory-stale",
66012
66645
  error: errorInfo2
66013
66646
  })
66014
66647
  );
66015
66648
  }
66016
66649
  }
66650
+ const errorInfo = getRiverbankErrorInfo(error);
66651
+ const durableFallback = allowFallbacks && !isPreview ? await tryPublishedRuntimeCacheFallback(
66652
+ options.publishedRuntimeCache,
66653
+ statusDetails,
66654
+ errorInfo
66655
+ ) : null;
66656
+ const durableCache = durableFallback?.kind === "miss" || durableFallback?.kind === "error" ? durableFallback.diagnostic : void 0;
66657
+ if (durableFallback?.kind === "hit") {
66658
+ return durableFallback.result;
66659
+ }
66017
66660
  if (allowFallbacks && !isPreview && options.prebuildFallback) {
66018
66661
  const prebuildResult = options.prebuildFallback();
66019
66662
  if (prebuildResult) {
66020
- const errorInfo2 = error instanceof RiverbankApiError ? {
66021
- code: error.code,
66022
- message: error.message,
66023
- status: error.status
66024
- } : { message: error.message };
66025
66663
  return emitStatus(
66026
66664
  "prebuild",
66027
66665
  prebuildResult.data,
66028
66666
  statusDetails({
66029
66667
  prebuildAgeSec: prebuildResult.prebuildAgeSec,
66030
- error: errorInfo2
66668
+ cacheTier: "prebuild",
66669
+ durableCache,
66670
+ error: errorInfo
66031
66671
  })
66032
66672
  );
66033
66673
  }
66034
66674
  }
66035
- const errorInfo = error instanceof RiverbankApiError ? { code: error.code, message: error.message, status: error.status } : { message: error.message };
66036
66675
  const failure = emitStatus(
66037
66676
  "error",
66038
66677
  null,
66039
- statusDetails({ error: errorInfo })
66678
+ statusDetails({ error: errorInfo, durableCache })
66040
66679
  );
66041
66680
  throw attachResilienceStatusToError(error, failure.resilience);
66042
66681
  }
@@ -66086,8 +66725,12 @@ function createRiverbankClient(config2) {
66086
66725
  );
66087
66726
  }
66088
66727
  const siteIdentifier = slug || domain || id;
66089
- const cacheKey = `site:${siteIdentifier ?? "unknown"}:${currentPath ?? ""}`;
66090
66728
  const siteId = id || slug || domain;
66729
+ const publishedRuntimeCache = planPublishedRuntimeCache({
66730
+ endpoint: "getSite",
66731
+ params: { slug, domain, id, currentPath, force }
66732
+ });
66733
+ const cacheKey = publishedRuntimeCache?.cacheKey ?? `site:${siteIdentifier ?? "unknown"}:${currentPath ?? ""}`;
66091
66734
  return resilientFetch(
66092
66735
  cacheKey,
66093
66736
  async (sig) => {
@@ -66110,13 +66753,19 @@ function createRiverbankClient(config2) {
66110
66753
  {
66111
66754
  signal,
66112
66755
  force,
66756
+ publishedRuntimeCache,
66113
66757
  prebuildFallback: prebuildLoader && siteId ? () => prebuildLoader.loadSite(siteId) : void 0
66114
66758
  }
66115
66759
  );
66116
66760
  }
66117
66761
  async function getPageWithResilienceInternal(params) {
66118
66762
  const { siteId, path: path27, preview = false, signal } = params;
66119
- const cacheKey = `page:${siteId}:${path27}:${preview}`;
66763
+ const publishedRuntimeCache = planPublishedRuntimeCache({
66764
+ endpoint: "getContentByPath",
66765
+ params: { siteId, path: path27, preview },
66766
+ siteId
66767
+ });
66768
+ const cacheKey = publishedRuntimeCache?.cacheKey ?? `page:${siteId}:${path27}:${preview}`;
66120
66769
  return resilientFetch(
66121
66770
  cacheKey,
66122
66771
  async (sig) => {
@@ -66129,6 +66778,7 @@ function createRiverbankClient(config2) {
66129
66778
  {
66130
66779
  preview,
66131
66780
  signal,
66781
+ publishedRuntimeCache,
66132
66782
  // Prebuild fallback only for published pages (not preview)
66133
66783
  prebuildFallback: prebuildLoader && !preview ? () => prebuildLoader.loadPage(siteId, path27) : void 0
66134
66784
  }