@riverbankcms/sdk 0.178.0 → 0.180.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 +15 -8
- package/dist/_dts/{BlocksIslandsHydrator-CrKsXtpD.d.ts → BlocksIslandsHydrator-DC_AvZwy.d.ts} +1 -1
- package/dist/_dts/{Page-C9i27wZA.d.ts → Page-DQOxVtp3.d.ts} +7 -7
- package/dist/_dts/{SdkPreviewMode-DzGSR3jh.d.ts → SdkPreviewMode-DrLgY9_f.d.ts} +3 -2
- package/dist/_dts/{client-BnYN6XsH.d.ts → client-BP7VBRvs.d.ts} +281 -72
- package/dist/_dts/{content-types-CXj6lp3d.d.ts → content-types-1-K2qi__.d.ts} +2 -2
- package/dist/_dts/{contracts-BZLwkTwL.d.ts → contracts-Dfqz0Tcu.d.ts} +6 -116
- package/dist/_dts/{generatePageMetadata-ByEWwe9j.d.ts → generatePageMetadata-CSfAqmry.d.ts} +2 -2
- package/dist/_dts/{index-BE9dWIsr.d.ts → index-B0_2-65A.d.ts} +3 -3
- package/dist/_dts/{index-0HFgCnGz.d.ts → index-BeM5Ylwf.d.ts} +5 -3
- package/dist/_dts/{index-D9-N1d9v.d.ts → index-Blrw2oVk.d.ts} +1 -1
- package/dist/_dts/{index-cTpvQg_Q.d.ts → index-CB5Csefo.d.ts} +2 -2
- package/dist/_dts/{index-nnEdgc3Z.d.ts → index-DCcxLa8p.d.ts} +4 -2
- package/dist/_dts/{index-DCa-8TEY.d.ts → index-DQBGwBPx.d.ts} +1 -1
- package/dist/_dts/{index-CKDRr54L.d.ts → index-DQr358-m.d.ts} +4 -4
- package/dist/_dts/{loadContent-DYkVV6w4.d.ts → loadContent-BG2tLGXj.d.ts} +15 -13
- package/dist/_dts/{request-B20VRWHH.d.ts → request-P08l6mkr.d.ts} +3641 -994
- package/dist/_dts/{resolveBlockData-C_aK5GIS.d.ts → resolveBlockData-BDHc8lFs.d.ts} +8 -5
- package/dist/_dts/resolvePageContent-Y3IZBbtL.d.ts +61 -0
- package/dist/_dts/sdk/src/bookings/index.d.ts +2 -2
- package/dist/_dts/sdk/src/client/types.d.ts +3 -3
- package/dist/_dts/sdk/src/client.d.ts +7 -7
- package/dist/_dts/sdk/src/config/index.d.ts +6 -6
- package/dist/_dts/sdk/src/config/template-validation.d.ts +1 -1
- package/dist/_dts/sdk/src/config/validation.d.ts +1 -1
- package/dist/_dts/sdk/src/data/dataLoaderContext.d.ts +2 -2
- package/dist/_dts/sdk/src/data/resolveBlockData.d.ts +1 -1
- package/dist/_dts/sdk/src/data/types.d.ts +7 -2
- package/dist/_dts/sdk/src/gifting/client.d.ts +1 -1
- package/dist/_dts/sdk/src/index.d.ts +8 -8
- package/dist/_dts/sdk/src/manifest/index.d.ts +3 -3
- package/dist/_dts/sdk/src/metadata/index.d.ts +1 -1
- package/dist/_dts/sdk/src/navigation/index.d.ts +3 -3
- package/dist/_dts/sdk/src/next/index.d.ts +16 -8
- package/dist/_dts/sdk/src/next/middleware.d.ts +2 -2
- package/dist/_dts/sdk/src/page-converter/index.d.ts +3 -3
- package/dist/_dts/sdk/src/portal/client.d.ts +3 -3
- package/dist/_dts/sdk/src/prebuild/index.d.ts +1 -1
- package/dist/_dts/sdk/src/preview-next/before-render.d.ts +2 -2
- package/dist/_dts/sdk/src/preview-next/client/index.d.ts +2 -2
- package/dist/_dts/sdk/src/preview-next/client/runtime.d.ts +1 -1
- package/dist/_dts/sdk/src/rendering/client.d.ts +2 -2
- package/dist/_dts/sdk/src/rendering/components/pageShared.d.ts +1 -1
- package/dist/_dts/sdk/src/rendering/helpers/loadPage.d.ts +1 -1
- package/dist/_dts/sdk/src/rendering/helpers/pageRuntimeSupport.d.ts +4 -4
- package/dist/_dts/sdk/src/rendering/index.d.ts +7 -7
- package/dist/_dts/sdk/src/rendering/islands/client.d.ts +1 -1
- package/dist/_dts/sdk/src/rendering/server.d.ts +3 -3
- package/dist/_dts/sdk/src/rendering/themeAdmission.d.ts +1 -1
- package/dist/_dts/sdk/src/routing/index.d.ts +19 -6
- package/dist/_dts/sdk/src/server.d.ts +5 -5
- package/dist/_dts/sdk/src/spam-protection/index.d.ts +2 -2
- package/dist/_dts/sdk/src/theme/index.d.ts +1 -1
- package/dist/_dts/serviceBookingOutline-BvtNagjw.d.ts +583 -0
- package/dist/_dts/{types-CYcd15BQ.d.ts → types-BrK6SS5c.d.ts} +9 -7
- package/dist/_dts/{types-CMZ5mkpv.d.ts → types-DpEAnP4F.d.ts} +10 -39
- package/dist/_dts/{types-rm2M4LGx.d.ts → types-HAy1-Jjo.d.ts} +3 -3
- package/dist/_dts/{validation-BSxnRhyy.d.ts → validation-D6q3tOBA.d.ts} +4 -4
- package/dist/client/{BlocksIslandsHydrator-D1n09bu-.mjs → BlocksIslandsHydrator-DJSmdNUJ.mjs} +17 -18
- package/dist/client/{BookingMailingListNote-DSD4gS96.mjs → BookingMailingListNote-CGxg37zx.mjs} +92 -60
- package/dist/client/{BookingQuestionFields-B57oGPcj.mjs → BookingQuestionFields-DXegGSnS.mjs} +26 -5
- package/dist/client/{CalendarNavigationChevron-qXvsFYOg.mjs → CalendarNavigationChevron-VfP50sYm.mjs} +42 -9
- package/dist/client/{CheckboxChoice-b-PJLEXe.mjs → CheckboxChoice-BZPLCgTU.mjs} +1 -1
- package/dist/client/{DemoBookingPortalAccess-Olvrwi3Z.mjs → DemoBookingPortalAccess-0Ua44F1j.mjs} +13 -8
- package/dist/client/{EventCalendar.client-DwFNFb-0.mjs → EventCalendar.client-CrpiyDSP.mjs} +10 -10
- package/dist/client/{EventCombined.client-Ffu-aVOb.mjs → EventCombined.client-D0me9wnz.mjs} +10 -10
- package/dist/client/{EventEmbeddedCheckoutStep-B18VbNS_.mjs → EventEmbeddedCheckoutStep-BDnicDM6.mjs} +1 -1
- package/dist/client/{EventItem-b8tVkNHA.mjs → EventItem-CJITrGkF.mjs} +249 -8
- package/dist/client/{EventListWeekNavigation-BxnJW_Gf.mjs → EventListWeekNavigation-BlEm_xjq.mjs} +1 -1
- package/dist/client/{EventListing.client-ViCnrNg4.mjs → EventListing.client-BNM_HuS0.mjs} +3 -3
- package/dist/client/{EventListing.view-CdjiepMf.mjs → EventListing.view-CXfb7RRy.mjs} +7 -16
- package/dist/client/{EventRegistrationPayment-BVd70XkH.mjs → EventRegistrationPayment-DiD9uYs6.mjs} +1439 -293
- package/dist/client/{Page-DqETUt-U.mjs → Page-bX7iy_MK.mjs} +24299 -20103
- package/dist/client/{ProtectedSubmitButton-C-ql101B.mjs → ProtectedSubmitButton-De6AzhE6.mjs} +1 -1
- package/dist/client/{SiteTermsAgreementField-DkFnbzf_.mjs → SiteTermsAgreementField-BAdW5DvE.mjs} +23 -16
- package/dist/client/{BookingPanelArrangement--EkA1ZQd.mjs → StepIndicator-DCfdcb7s.mjs} +12 -12
- package/dist/client/{StepIndicator-JO2PS03n.mjs → StepIndicator-DCqorVne.mjs} +7 -7
- package/dist/client/{TabBarFragment-BqfRLojo.mjs → TabBarFragment-DlKQRhP4.mjs} +1 -1
- package/dist/client/{ThemedButton-DuaYtnvG.mjs → ThemedButton-CnSa7o-I.mjs} +66 -66
- package/dist/client/{accessibleSurfaces-DN8it_Cx.mjs → accessibleSurfaces-Wl8-_OVJ.mjs} +1 -1
- package/dist/client/{accordion-XgNxl0Wg.mjs → accordion-wofJY8xY.mjs} +1 -1
- package/dist/client/{booking-form.client-ljJoDwuI.mjs → booking-form.client-CYl9NrqS.mjs} +412 -79
- package/dist/client/{bookingForm-DtEHwY4W.mjs → bookingForm-kgVWtuMe.mjs} +4 -4
- package/dist/client/bookings.mjs +40 -10
- package/dist/client/{boxStyleClassNames-BHoMAcun.mjs → boxStyleClassNames-CQHWz5gJ.mjs} +19 -19
- package/dist/client/{carousel-B3UhbFu7.mjs → carousel-BE1dEFsD.mjs} +2 -2
- package/dist/client/{carousel.client-h65clfUO.mjs → carousel.client-DMtGYTTM.mjs} +1 -1
- package/dist/client/{cart-DzOJfYOR.mjs → cart-BsjsdGZE.mjs} +3 -3
- package/dist/client/{cart.client-DBG77v-5.mjs → cart.client-DylGUWXY.mjs} +1 -1
- package/dist/client/{checkout-LmePoEgM.mjs → checkout-B5KxEUDr.mjs} +3 -3
- package/dist/client/{checkout.client-DmgZuLBT.mjs → checkout.client-C98fhch3.mjs} +1 -1
- package/dist/client/{checkoutUrls-CMZI8o_V.mjs → checkoutUrls-BMLYTf38.mjs} +1 -1
- package/dist/client/client.mjs +502 -341
- package/dist/client/constants-PfYJsEZF.mjs +101 -0
- package/dist/client/{context-CJIz4FdL.mjs → context-DtKdUdkO.mjs} +200 -27
- package/dist/client/{dateFormatting-UoXqBh10.mjs → dateFormatting-BaGPvQS3.mjs} +1 -1
- package/dist/client/{demoPortalMagicLink-6CgFZNvu.mjs → demoPortalMagicLink-B8eDjhuG.mjs} +1 -1
- package/dist/client/{enhanceHeaderSection-DaMo6len.mjs → enhanceHeaderSection-DvhD-8eE.mjs} +4 -4
- package/dist/client/{event-registration.client-b6APrFQe.mjs → event-registration.client-Du9a_xAN.mjs} +1982 -1519
- package/dist/client/{eventCalendar-DJYz7yZf.mjs → eventCalendar-Di9wDfzl.mjs} +4 -4
- package/dist/client/{eventCombined-j9VCVgMW.mjs → eventCombined-CNW6nBsB.mjs} +4 -4
- package/dist/client/{eventListing-DWgpGuFM.mjs → eventListing-CQMxQ8By.mjs} +4 -4
- package/dist/client/{eventRegistration-DCinRot3.mjs → eventRegistration-CprS9k1D.mjs} +4 -4
- package/dist/client/events-9LPvwbWp.mjs +28 -0
- package/dist/client/{form-BBBtRwvy.mjs → form-Zl1_8RJ6.mjs} +3 -3
- package/dist/client/{form.client-CZeRQLGF.mjs → form.client-TaMUys6I.mjs} +5 -5
- package/dist/client/{form.parts-DhGGv4_L.mjs → form.parts-CpNPbPPM.mjs} +3 -3
- package/dist/client/{formatDate-DVFVDcDW.mjs → formatDate-hhI1-tzt.mjs} +1 -1
- package/dist/client/gifting/client.mjs +6 -6
- package/dist/client/{gifting-Di9-SpwW.mjs → gifting-DNVa7-Wj.mjs} +4 -4
- package/dist/client/{gifting.client-CjT5PrAZ.mjs → gifting.client-CFUq3GVx.mjs} +5 -5
- package/dist/client/{gifting.parts-ffP6mjMd.mjs → gifting.parts-CDQvxA4A.mjs} +2 -2
- package/dist/client/{headerSection-jjAvtSZk.mjs → headerSection-Cg6083rn.mjs} +2 -2
- package/dist/client/{lookSurfaces-C2VzJfyG.mjs → lookSurfaces-gJ3OqPf9.mjs} +258 -86
- package/dist/client/{newsletter-form.client-D45frHoa.mjs → newsletter-form.client-VuL9I96G.mjs} +6 -6
- package/dist/client/{shop.interactive-D7wky1GL.mjs → newsletter-form.interactive-7Of3eYn0.mjs} +4023 -4029
- package/dist/client/{newsletter-form.parts-CHdg82ct.mjs → newsletter-form.parts-OBqsfT24.mjs} +2 -2
- package/dist/client/{newsletterForm-tS465_vl.mjs → newsletterForm-BkJe_RTv.mjs} +3 -3
- package/dist/client/portal/client.mjs +301 -117
- package/dist/client/{product-detail.client-DIWSeW7P.mjs → product-detail.client-B2hdxqJN.mjs} +1 -1
- package/dist/client/{product-list.client-BRf14h_e.mjs → product-list.client-CCEgu9rx.mjs} +1 -1
- package/dist/client/{productDetail-gxF5whea.mjs → productDetail-CRX_ZRfS.mjs} +3 -3
- package/dist/client/{productList-B9t0XJrN.mjs → productList-BAdJ6z5S.mjs} +3 -3
- package/dist/client/{propsDecoder-Db8wAmgr.mjs → propsDecoder-BLKAmX0S.mjs} +2 -48
- package/dist/client/{registry.server-Bn0gE0uP.mjs → registry.server-Bj9cmHHF.mjs} +10464 -9113
- package/dist/client/rendering/client.mjs +41 -27
- package/dist/client/rendering/islands.mjs +1 -1
- package/dist/client/rendering.mjs +23 -2836
- package/dist/client/{richText-coerce-COnKrLO7.mjs → richText-coerce-Z45OLLEX.mjs} +1 -1
- package/dist/client/{routeIslandApiConfig-Bok1Oy50.mjs → routeIslandApiConfig-DHpTTK77.mjs} +1 -1
- package/dist/client/runtimeResponse-D2j2-mOk.mjs +3 -0
- package/dist/client/{runtimeResponse-9v8q2NBc.mjs → runtimeResponse-DtWSfWSZ.mjs} +1 -1
- package/dist/client/{shop-D1oTPDxm.mjs → shop-BKsgxm_-.mjs} +3 -3
- package/dist/client/{shop-commerce-DyMZLC0a.mjs → shop-commerce-Cbtk_kUW.mjs} +14 -14
- package/dist/client/{shop-commerce-store-FODNS63D.mjs → shop-commerce-store-B-rv2p5h.mjs} +1 -1
- package/dist/client/{shop-discount-apply.state-C4xcmFzZ.mjs → shop-discount-apply.state-CiCDLNh7.mjs} +2 -2
- package/dist/client/{shop.client-CRgRulfI.mjs → shop.client-Rnqa74Tk.mjs} +14 -14
- package/dist/client/{shopShared-Bd_hy9ZO.mjs → shopShared-BaBfhjCq.mjs} +2 -2
- package/dist/client/spam-protection.mjs +1 -1
- package/dist/client/{noop-D11X-B6n.mjs → src-o7WEvbK1.mjs} +398 -308
- package/dist/client/{timetableModel-UlWfP1gh.mjs → timetableModel-BOff1Kk5.mjs} +259 -11
- package/dist/client/{types-DjWUR_O6.mjs → types-BEaKfam_.mjs} +65 -65
- package/dist/client/{useAvailableSlots-D-qoooLy.mjs → useAvailableSlots-DQJNh10g.mjs} +3 -23
- package/dist/client/useDiscountCodeUi-BcFQRI_7.mjs +196 -0
- package/dist/client/{useEventPagination-CQH2e9sQ.mjs → useEventPagination-BvdcexDC.mjs} +8 -8
- package/dist/client/{view-bGU1ws-m.mjs → view-CTBwSpKv.mjs} +4 -4
- package/dist/client/{display-D1oVR5Eh.mjs → wizardSteps-CWIQyRIw.mjs} +10263 -9078
- package/dist/preview-next/before-render.mjs +5 -3
- package/dist/preview-next/client/{LocationPickerEnvironment-BHAT81Wx.mjs → LocationPickerEnvironment-BW3dRFIv.mjs} +1 -1
- package/dist/preview-next/client/{MapLibreEditMap-B52hkdIZ.mjs → MapLibreEditMap-Db9BHyXh.mjs} +2 -2
- package/dist/preview-next/client/{PageSectionToolbar-D-Le7O3o.mjs → PageSectionToolbar-CG6KwITA.mjs} +4 -4
- package/dist/preview-next/client/{PreviewEditorSidebar-DNy5j_ce.mjs → PreviewEditorSidebar-BGBqrC9m.mjs} +8 -7
- package/dist/preview-next/client/{PreviewEditorUI-CzJvgbqt.mjs → PreviewEditorUI-Bwkyx28x.mjs} +5 -5
- package/dist/preview-next/client/{PreviewShell-xhJ6ca1i.mjs → PreviewShell-DB1l6JNU.mjs} +7 -7
- package/dist/preview-next/client/{SdkPreviewModeRuntime-BmYO1TdT.mjs → SdkPreviewModeRuntime-Bs6Cwzr3.mjs} +15 -7
- package/dist/preview-next/client/{lucide-react-McYZeSMb.mjs → lucide-react-00FF_oar.mjs} +13 -1
- package/dist/preview-next/client/{previewAssistantSlot-BN93X9o1.mjs → previewAssistantSlot-T-oDD_Dd.mjs} +6252 -2461
- package/dist/preview-next/client/{previewChromeRoot-C51RQseo.mjs → previewChromeRoot-BeukcDRy.mjs} +1 -1
- package/dist/preview-next/client/runtime.mjs +3 -3
- package/dist/preview-next/client/{sdk-runtime-oeGquJM-.mjs → sdk-runtime-ceDW_9q2.mjs} +2 -2
- package/dist/preview-next/client/{siteStyleAccess-BGTAcPud.mjs → siteStyleAccess-CCB9bScO.mjs} +35 -23
- package/dist/preview-next/client/{useAutosaveStatus-BMGXjGZq.mjs → useAutosaveStatus-D4o0CKq7.mjs} +1 -1
- package/dist/preview-next/client/{useOpenBlockForSetup-CTDoR_gQ.mjs → useOpenBlockForSetup-Seccrvwu.mjs} +2 -2
- package/dist/preview-next/container-responsive.css +103 -10
- package/dist/preview-next/keepAlive.mjs +1 -1
- package/dist/preview-next/middleware.mjs +1 -1
- package/dist/preview-next/{route-contract-BtdzkSUg.mjs → route-contract-FwFj8zGL.mjs} +71 -10
- package/dist/server/{Block.shared-Bp3OlOjj.mjs → Block.shared-D6WrRCxX.mjs} +4 -4
- package/dist/server/{ThemeScopeCore-DFEM1a85.mjs → ThemeScopeCore-BQzjDQ2q.mjs} +8 -1
- package/dist/server/{bindings-DrbJuftt.mjs → bindings-CS6ih1Yc.mjs} +37 -6
- package/dist/server/{client-Bf06n9oj.mjs → client-m0ylCj_f.mjs} +436 -526
- package/dist/server/config-validation.mjs +1 -1
- package/dist/server/config.mjs +2 -2
- package/dist/server/contentTypeResolver-B9vy8BrF.mjs +19 -0
- package/dist/server/data/dataLoaderContext.mjs +1 -1
- package/dist/server/data/resolveBlockData.mjs +1 -1
- package/dist/server/{dataLoaderContext-B3fXA54R.mjs → dataLoaderContext-lMRTfG5Z.mjs} +1 -0
- package/dist/server/error-f4g44bKx.mjs +387 -0
- package/dist/server/index.mjs +3 -2
- package/dist/server/loadContent-vgWMz1uD.mjs +694 -0
- package/dist/server/{loadPage-5iZefzDd.mjs → loadPage-CIOL3-9t.mjs} +22 -4
- package/dist/server/{lookMediaFrame-CaH018pK.mjs → lookMediaFrame-m-91jGGn.mjs} +36 -0
- package/dist/server/next.mjs +67 -94
- package/dist/server/{overrideResolution-CUHtm7tW.mjs → overrideResolution-BiHmsvTZ.mjs} +1 -1
- package/dist/server/page-converter.mjs +1 -1
- package/dist/server/{pageRenderPlan-GmPXForc.mjs → pageRenderPlan-DJo_obpi.mjs} +15 -8
- package/dist/server/{pageRuntimeSupport-Dd8LFzfa.mjs → pageRuntimeSupport-BnSuoHON.mjs} +54 -2
- package/dist/server/{pageShared-tz-GVWft.mjs → pageShared-BJuOzxzn.mjs} +554 -304
- package/dist/server/{prebuild-JmsuYCIH.mjs → prebuild-Cr8p8T7V.mjs} +5 -4
- package/dist/server/prebuild.mjs +1 -1
- package/dist/server/{prefetchBlockData-Ce9DDwON.mjs → prefetchBlockData-BZh57-ua.mjs} +5 -3
- package/dist/server/{registry-D12XF_h1.mjs → registry-CvhFwbXJ.mjs} +358 -95
- package/dist/server/rendering/components/pageShared.mjs +1 -1
- package/dist/server/rendering/helpers/loadPage.mjs +1 -1
- package/dist/server/rendering/helpers/pageRuntimeSupport.mjs +1 -1
- package/dist/server/rendering/server.mjs +5 -4
- package/dist/server/rendering.mjs +9 -8
- package/dist/server/{resolveBlockData-D9yZIN3V.mjs → resolveBlockData-Cv_W1LVB.mjs} +61 -34
- package/dist/server/resolvePageContent-BWKUZUIn.mjs +89 -0
- package/dist/server/{responseMedia-F-ElH2Rd.mjs → responseMedia-KRKguBC5.mjs} +56 -1
- package/dist/server/routing.mjs +271 -57
- package/dist/server/server.mjs +3 -3
- package/dist/server/{loadContent-eaTY7RPg.mjs → servicePageContent-CRKbTm_7.mjs} +719 -459
- package/dist/server/theme-bridge.mjs +1 -1
- package/dist/server/{validation-CLq5cw6M.mjs → validation-DCl-FCk_.mjs} +4 -4
- package/dist/server/{version-oPbhAx8E.mjs → version-DT_R5JAR.mjs} +1 -1
- package/dist/styles/index.css +504 -27
- package/package.json +1 -1
- package/dist/_dts/footerPageOutline-D_XbQW_o.d.ts +0 -256
- package/dist/_dts/resolvePageContent-YT6ndha1.d.ts +0 -162
- package/dist/client/LocationMapActions-CiMtl1Ha.mjs +0 -62
- package/dist/client/MapDrawingSvg-BCZa3dpf.mjs +0 -200
- package/dist/client/constants-4o4_hl34.mjs +0 -6
- package/dist/client/course-DBEU9IA9.mjs +0 -244
- package/dist/client/duration-Q6_QNgiv.mjs +0 -37
- package/dist/client/event-details.client-BwASwKIq.mjs +0 -53
- package/dist/client/eventDetails-BzGOVDI-.mjs +0 -13
- package/dist/client/runtimeResponse-CVkM0dHy.mjs +0 -3
- package/dist/client/useDiscountCodeUi-B9DODAkj.mjs +0 -237
- package/dist/client/view-DNX59QwM.mjs +0 -1372
- package/dist/server/resolvePageContent-CAELMBEJ.mjs +0 -438
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { n as parseSurfaceTree } from "./accessibleSurfaces-CM3QANtw.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { i as rethrowClientFrameworkSignal, l as isSupportedLoaderEndpoint, o as encodePublicProductCategorySelector, r as findFrameworkSignal, t as materializeEntriesMedia } from "./responseMedia-KRKguBC5.mjs";
|
|
3
3
|
import { f as parseSiteId, t as publicMapLocationParamsSchema } from "./mapLocation-BM5WX7FY.mjs";
|
|
4
|
-
import { t as
|
|
4
|
+
import { a as ApiEnvelopeError, c as unwrapResponse, i as ApiRequestError, l as CLIENT_ERROR_REPORT_ENDPOINT_DEFINITIONS, n as attachResilienceStatusToError, o as extractApiEnvelopeErrorDetails, s as isApiError, t as RiverbankApiError, u as defineEndpointDefinitions } from "./error-f4g44bKx.mjs";
|
|
5
|
+
import { t as SDK_VERSION } from "./version-DT_R5JAR.mjs";
|
|
5
6
|
import { z } from "zod";
|
|
6
7
|
/**
|
|
7
8
|
* How long a rendered page may hold availability it read through the batch
|
|
@@ -43,7 +44,6 @@ const PUBLIC_READ_CACHE_POLICIES = {
|
|
|
43
44
|
"public_memberships"
|
|
44
45
|
], "batch_only"),
|
|
45
46
|
getPublicMapLocation: availability(["public_events", "public_event_filters"], "batch_only"),
|
|
46
|
-
resolveEventSubroute: availability(["public_events", "public_event_filters"], "direct"),
|
|
47
47
|
listPublicRouteCandidates: content(["published_content"], "batch_only"),
|
|
48
48
|
listPublicTeamMembers: content(["public_team_members"]),
|
|
49
49
|
listPublicProducts: availability(["public_products"], "direct"),
|
|
@@ -95,15 +95,6 @@ const BEFORE_BOOKING_QUESTIONS_ROUTE = {
|
|
|
95
95
|
method: "POST"
|
|
96
96
|
};
|
|
97
97
|
//#endregion
|
|
98
|
-
//#region ../api/src/defineEndpointDefinitions.ts
|
|
99
|
-
/**
|
|
100
|
-
* Validates extracted endpoint descriptors while preserving each literal path,
|
|
101
|
-
* method, and parameter contract for the typed URL builders.
|
|
102
|
-
*/
|
|
103
|
-
function defineEndpointDefinitions(definitions) {
|
|
104
|
-
return definitions;
|
|
105
|
-
}
|
|
106
|
-
//#endregion
|
|
107
98
|
//#region ../api/src/apiEndpointTypes.ts
|
|
108
99
|
function allowedDemoMutationPolicy() {
|
|
109
100
|
return {
|
|
@@ -682,6 +673,23 @@ function buildFetchPolicy(siteId, reads, freshnessSeconds) {
|
|
|
682
673
|
function buildPublicReadBatchFetchPolicy(siteId, reads) {
|
|
683
674
|
return buildFetchPolicy(siteId, reads, publicReadBatchFreshnessSeconds);
|
|
684
675
|
}
|
|
676
|
+
/** A page may depend on admission even when an ordinary CMS page won precedence. */
|
|
677
|
+
function buildPageReadCachePolicy(siteId, dependencies) {
|
|
678
|
+
return dependencies === "availability" ? {
|
|
679
|
+
tags: normalizeRevalidateTags([
|
|
680
|
+
...buildCacheReadTags([TAG_TEMPLATES.siteRoutableContent], { siteId }),
|
|
681
|
+
...buildPublicReadFetchTags("listPublicEvents", { siteId }),
|
|
682
|
+
...buildPublicReadFetchTags("getPublicBookingService", { siteId })
|
|
683
|
+
]),
|
|
684
|
+
revalidate: 60
|
|
685
|
+
} : {
|
|
686
|
+
tags: buildCacheReadTags([TAG_TEMPLATES.siteRoutableContent], { siteId }),
|
|
687
|
+
revalidate: PUBLIC_CONTENT_FRESHNESS_SECONDS
|
|
688
|
+
};
|
|
689
|
+
}
|
|
690
|
+
function pageReadDependencies(payload) {
|
|
691
|
+
return typeof payload === "object" && payload !== null && "dependencies" in payload && payload.dependencies === "content" ? "content" : "availability";
|
|
692
|
+
}
|
|
685
693
|
//#endregion
|
|
686
694
|
//#region ../api/src/sdkEntryReadEndpoints.ts
|
|
687
695
|
const SDK_ENTRY_READ_ENDPOINTS = {
|
|
@@ -1369,6 +1377,17 @@ const APPOINTMENT_ENDPOINT_DEFINITIONS = defineEndpointDefinitions({
|
|
|
1369
1377
|
"server:internal_error"
|
|
1370
1378
|
]
|
|
1371
1379
|
},
|
|
1380
|
+
getTeamMemberTemplatePreview: {
|
|
1381
|
+
path: "/sites/{siteId}/bookings/profile-editor/{entryId}/template-preview",
|
|
1382
|
+
method: "GET",
|
|
1383
|
+
auth: "user",
|
|
1384
|
+
responseKind: "json",
|
|
1385
|
+
errors: [
|
|
1386
|
+
"auth:forbidden",
|
|
1387
|
+
"resource:not_found",
|
|
1388
|
+
"server:internal_error"
|
|
1389
|
+
]
|
|
1390
|
+
},
|
|
1372
1391
|
updateTeamMemberProfilePolicy: {
|
|
1373
1392
|
path: "/sites/{siteId}/bookings/resources/profile-policy",
|
|
1374
1393
|
method: "PUT",
|
|
@@ -2895,15 +2914,6 @@ const PUBLIC_EVENT_ENDPOINT_DEFINITIONS = defineEndpointDefinitions({
|
|
|
2895
2914
|
"resource:conflict",
|
|
2896
2915
|
"server:internal_error"
|
|
2897
2916
|
]
|
|
2898
|
-
},
|
|
2899
|
-
resolveEventSubroute: {
|
|
2900
|
-
path: "/public/sites/{siteId}/events/subroutes/resolve",
|
|
2901
|
-
method: "GET",
|
|
2902
|
-
revalidate: publicReadFreshnessSeconds("resolveEventSubroute"),
|
|
2903
|
-
tags: [TAG_TEMPLATES.publicEvents, "event-subroute"],
|
|
2904
|
-
auth: "public",
|
|
2905
|
-
responseKind: "json",
|
|
2906
|
-
errors: []
|
|
2907
2917
|
}
|
|
2908
2918
|
});
|
|
2909
2919
|
//#endregion
|
|
@@ -4357,52 +4367,6 @@ const BOOKING_PEOPLE_ENDPOINT_DEFINITIONS = defineEndpointDefinitions({
|
|
|
4357
4367
|
]
|
|
4358
4368
|
}
|
|
4359
4369
|
});
|
|
4360
|
-
//#endregion
|
|
4361
|
-
//#region ../api/src/clientErrorReporting.ts
|
|
4362
|
-
const CLIENT_ERROR_REPORT_ENDPOINT_DEFINITIONS = defineEndpointDefinitions({ reportClientError: {
|
|
4363
|
-
path: "/client/error-report",
|
|
4364
|
-
method: "POST",
|
|
4365
|
-
auth: "user",
|
|
4366
|
-
errors: [],
|
|
4367
|
-
responseKind: "json"
|
|
4368
|
-
} });
|
|
4369
|
-
const CLIENT_ERROR_REPORT_LIMITS = {
|
|
4370
|
-
pathname: 1024,
|
|
4371
|
-
name: 120,
|
|
4372
|
-
message: 2e3,
|
|
4373
|
-
stack: 8e3,
|
|
4374
|
-
digest: 128,
|
|
4375
|
-
componentStack: 8e3,
|
|
4376
|
-
sourceLocation: 1024,
|
|
4377
|
-
navigationAgeMs: 6e4
|
|
4378
|
-
};
|
|
4379
|
-
const clientErrorEventSchema = z.enum([
|
|
4380
|
-
"dashboard:route-error",
|
|
4381
|
-
"dashboard:app-error",
|
|
4382
|
-
"client:error-boundary",
|
|
4383
|
-
"client:window-error",
|
|
4384
|
-
"client:unhandled-rejection"
|
|
4385
|
-
]);
|
|
4386
|
-
z.object({
|
|
4387
|
-
event: clientErrorEventSchema,
|
|
4388
|
-
pathname: z.string().startsWith("/").max(CLIENT_ERROR_REPORT_LIMITS.pathname),
|
|
4389
|
-
name: z.string().max(CLIENT_ERROR_REPORT_LIMITS.name),
|
|
4390
|
-
message: z.string().max(CLIENT_ERROR_REPORT_LIMITS.message),
|
|
4391
|
-
stack: z.string().max(CLIENT_ERROR_REPORT_LIMITS.stack).nullable(),
|
|
4392
|
-
digest: z.string().max(CLIENT_ERROR_REPORT_LIMITS.digest).nullable(),
|
|
4393
|
-
componentStack: z.string().max(CLIENT_ERROR_REPORT_LIMITS.componentStack).nullable(),
|
|
4394
|
-
sourceLocation: z.string().max(CLIENT_ERROR_REPORT_LIMITS.sourceLocation).nullable(),
|
|
4395
|
-
navigation: z.object({
|
|
4396
|
-
fromPathname: z.string().regex(/^\/[^?#]*$/).max(CLIENT_ERROR_REPORT_LIMITS.pathname),
|
|
4397
|
-
toPathname: z.string().regex(/^\/[^?#]*$/).max(CLIENT_ERROR_REPORT_LIMITS.pathname),
|
|
4398
|
-
type: z.enum([
|
|
4399
|
-
"push",
|
|
4400
|
-
"replace",
|
|
4401
|
-
"traverse"
|
|
4402
|
-
]),
|
|
4403
|
-
ageMs: z.number().int().min(0).max(CLIENT_ERROR_REPORT_LIMITS.navigationAgeMs)
|
|
4404
|
-
}).strict().nullable().optional()
|
|
4405
|
-
}).strict();
|
|
4406
4370
|
const API_ENDPOINTS$1 = {
|
|
4407
4371
|
...PAGE_SECTION_LOOK_ENDPOINT_DEFINITIONS,
|
|
4408
4372
|
...PAGE_JOURNAL_ENDPOINT_DEFINITIONS,
|
|
@@ -6109,6 +6073,14 @@ const API_ENDPOINTS$1 = {
|
|
|
6109
6073
|
responseKind: "json",
|
|
6110
6074
|
errors: []
|
|
6111
6075
|
},
|
|
6076
|
+
adminDeleteSupportTicketScreenshot: {
|
|
6077
|
+
path: "/admin/support/tickets/screenshot/delete",
|
|
6078
|
+
method: "POST",
|
|
6079
|
+
tags: ["admin", "support"],
|
|
6080
|
+
auth: "admin",
|
|
6081
|
+
responseKind: "json",
|
|
6082
|
+
errors: []
|
|
6083
|
+
},
|
|
6112
6084
|
mfaTotpEnroll: {
|
|
6113
6085
|
path: "/auth/mfa/totp/enroll",
|
|
6114
6086
|
method: "POST",
|
|
@@ -7110,6 +7082,7 @@ const API_ENDPOINTS$1 = {
|
|
|
7110
7082
|
responseKind: "json"
|
|
7111
7083
|
},
|
|
7112
7084
|
resolveRouteOutcome: {
|
|
7085
|
+
revalidate: PUBLIC_CONTENT_FRESHNESS_SECONDS,
|
|
7113
7086
|
path: "/sites/{siteId}/route-outcome",
|
|
7114
7087
|
method: "GET",
|
|
7115
7088
|
tags: [
|
|
@@ -7810,6 +7783,38 @@ const API_ENDPOINTS$1 = {
|
|
|
7810
7783
|
"server:internal_error"
|
|
7811
7784
|
]
|
|
7812
7785
|
},
|
|
7786
|
+
getEventRoomsRoster: {
|
|
7787
|
+
errors: [],
|
|
7788
|
+
path: "/sites/{siteId}/bookings/event-series/{seriesId}/rooms",
|
|
7789
|
+
method: "GET",
|
|
7790
|
+
tags: ["site-{siteId}", "event-series-{seriesId}"],
|
|
7791
|
+
auth: "user",
|
|
7792
|
+
responseKind: "json"
|
|
7793
|
+
},
|
|
7794
|
+
getChangeEventRoomOptions: {
|
|
7795
|
+
errors: [],
|
|
7796
|
+
path: "/sites/{siteId}/bookings/event-series/{seriesId}/rooms/change/options",
|
|
7797
|
+
method: "GET",
|
|
7798
|
+
tags: [
|
|
7799
|
+
"site-{siteId}",
|
|
7800
|
+
"event-series-{seriesId}",
|
|
7801
|
+
"bookings"
|
|
7802
|
+
],
|
|
7803
|
+
auth: "user",
|
|
7804
|
+
responseKind: "json"
|
|
7805
|
+
},
|
|
7806
|
+
changeEventRoom: {
|
|
7807
|
+
errors: [],
|
|
7808
|
+
path: "/sites/{siteId}/bookings/event-series/{seriesId}/rooms/change",
|
|
7809
|
+
method: "POST",
|
|
7810
|
+
tags: [
|
|
7811
|
+
"site-{siteId}",
|
|
7812
|
+
"event-series-{seriesId}",
|
|
7813
|
+
"bookings"
|
|
7814
|
+
],
|
|
7815
|
+
auth: "user",
|
|
7816
|
+
responseKind: "json"
|
|
7817
|
+
},
|
|
7813
7818
|
listEventSeriesAttendees: {
|
|
7814
7819
|
path: "/sites/{siteId}/bookings/event-series/{seriesId}/attendees",
|
|
7815
7820
|
method: "GET",
|
|
@@ -8037,6 +8042,25 @@ const API_ENDPOINTS$1 = {
|
|
|
8037
8042
|
"bookings"
|
|
8038
8043
|
]
|
|
8039
8044
|
},
|
|
8045
|
+
listEventBookingTicketChoices: {
|
|
8046
|
+
errors: [],
|
|
8047
|
+
path: "/sites/{siteId}/bookings/event-attendees/{attendeeId}/ticket-choices",
|
|
8048
|
+
method: "GET",
|
|
8049
|
+
auth: "user",
|
|
8050
|
+
responseKind: "json"
|
|
8051
|
+
},
|
|
8052
|
+
changeEventBookingTickets: {
|
|
8053
|
+
errors: [],
|
|
8054
|
+
path: "/sites/{siteId}/bookings/event-attendees/{attendeeId}/change-tickets",
|
|
8055
|
+
method: "POST",
|
|
8056
|
+
auth: "user",
|
|
8057
|
+
responseKind: "json",
|
|
8058
|
+
tags: [
|
|
8059
|
+
"site-{siteId}",
|
|
8060
|
+
"event-attendee-{attendeeId}",
|
|
8061
|
+
"bookings"
|
|
8062
|
+
]
|
|
8063
|
+
},
|
|
8040
8064
|
restoreEventBooking: {
|
|
8041
8065
|
errors: [],
|
|
8042
8066
|
path: "/sites/{siteId}/bookings/event-attendees/{attendeeId}/restore",
|
|
@@ -10091,147 +10115,6 @@ const API_ENDPOINTS$1 = {
|
|
|
10091
10115
|
}
|
|
10092
10116
|
};
|
|
10093
10117
|
//#endregion
|
|
10094
|
-
//#region ../api/src/common/capacityOverride.ts
|
|
10095
|
-
const capacityOverrideRefusalSchema = z.object({
|
|
10096
|
-
booked: z.number().int().nonnegative(),
|
|
10097
|
-
held: z.number().int().nonnegative(),
|
|
10098
|
-
capacity: z.number().int().nonnegative(),
|
|
10099
|
-
name: z.string(),
|
|
10100
|
-
retryPersonId: z.string().optional()
|
|
10101
|
-
});
|
|
10102
|
-
function isCapacityOverrideRefusal(value) {
|
|
10103
|
-
return capacityOverrideRefusalSchema.safeParse(value).success;
|
|
10104
|
-
}
|
|
10105
|
-
const API_ERROR_CODE_SET = /* @__PURE__ */ new Set([
|
|
10106
|
-
"auth:unauthenticated",
|
|
10107
|
-
"auth:token_expired",
|
|
10108
|
-
"auth:token_invalid",
|
|
10109
|
-
"auth:forbidden",
|
|
10110
|
-
"auth:mfa_required",
|
|
10111
|
-
"auth:mfa_setup_required",
|
|
10112
|
-
"auth:sudo_required",
|
|
10113
|
-
"auth:insufficient_permissions",
|
|
10114
|
-
"auth:impersonation_restricted",
|
|
10115
|
-
"auth:lease_required",
|
|
10116
|
-
"auth:lease_lost",
|
|
10117
|
-
"client:editing_held",
|
|
10118
|
-
"site_terms_changed",
|
|
10119
|
-
"site_terms_agreement_missing",
|
|
10120
|
-
"validation:invalid_input",
|
|
10121
|
-
"validation:missing_field",
|
|
10122
|
-
"validation:invalid_format",
|
|
10123
|
-
"validation:payload_too_large",
|
|
10124
|
-
"resource:not_found",
|
|
10125
|
-
"resource:already_exists",
|
|
10126
|
-
"resource:conflict",
|
|
10127
|
-
"resource:gone",
|
|
10128
|
-
"rate_limit:exceeded",
|
|
10129
|
-
"billing:payment_required",
|
|
10130
|
-
"billing:plan_limit_exceeded",
|
|
10131
|
-
"billing:pass_redemption_failed",
|
|
10132
|
-
"server:internal_error",
|
|
10133
|
-
"server:unavailable",
|
|
10134
|
-
"external:service_error",
|
|
10135
|
-
"external:registrar_orphaned_contact_profile",
|
|
10136
|
-
"network:connection_error",
|
|
10137
|
-
"network:timeout",
|
|
10138
|
-
"network:dns_error"
|
|
10139
|
-
]);
|
|
10140
|
-
function isApiErrorCode(value) {
|
|
10141
|
-
return typeof value === "string" && API_ERROR_CODE_SET.has(value);
|
|
10142
|
-
}
|
|
10143
|
-
function isApiError(result) {
|
|
10144
|
-
return result.success === false;
|
|
10145
|
-
}
|
|
10146
|
-
function isApiSuccess(result) {
|
|
10147
|
-
return result.success === true;
|
|
10148
|
-
}
|
|
10149
|
-
function isRecord(value) {
|
|
10150
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
10151
|
-
}
|
|
10152
|
-
function isFieldError(value) {
|
|
10153
|
-
return isRecord(value) && typeof value.field === "string" && typeof value.code === "string" && typeof value.message === "string" && (value.capacityOverride === void 0 || isCapacityOverrideRefusal(value.capacityOverride));
|
|
10154
|
-
}
|
|
10155
|
-
function fieldErrorsFromUnknown(value) {
|
|
10156
|
-
if (!Array.isArray(value)) return null;
|
|
10157
|
-
return value.every(isFieldError) ? value : null;
|
|
10158
|
-
}
|
|
10159
|
-
function extractEnvelopeErrorObject(body) {
|
|
10160
|
-
if (!isRecord(body)) return null;
|
|
10161
|
-
const error = body.error;
|
|
10162
|
-
if (!isRecord(error)) return null;
|
|
10163
|
-
if ("success" in body && body.success !== false) return null;
|
|
10164
|
-
return error;
|
|
10165
|
-
}
|
|
10166
|
-
function extractApiEnvelopeErrorDetails(body) {
|
|
10167
|
-
const error = extractEnvelopeErrorObject(body);
|
|
10168
|
-
if (!error) return {
|
|
10169
|
-
rawCode: null,
|
|
10170
|
-
code: null,
|
|
10171
|
-
tag: null,
|
|
10172
|
-
message: null,
|
|
10173
|
-
status: null,
|
|
10174
|
-
fieldErrors: null
|
|
10175
|
-
};
|
|
10176
|
-
const rawCode = typeof error.code === "string" ? error.code : null;
|
|
10177
|
-
const message = typeof error.message === "string" && error.message.trim().length > 0 ? error.message : null;
|
|
10178
|
-
return {
|
|
10179
|
-
rawCode,
|
|
10180
|
-
code: isApiErrorCode(rawCode) ? rawCode : null,
|
|
10181
|
-
tag: typeof error.tag === "string" ? error.tag : null,
|
|
10182
|
-
message,
|
|
10183
|
-
status: typeof error.status === "number" && Number.isFinite(error.status) ? error.status : null,
|
|
10184
|
-
fieldErrors: fieldErrorsFromUnknown(error.fieldErrors)
|
|
10185
|
-
};
|
|
10186
|
-
}
|
|
10187
|
-
/**
|
|
10188
|
-
* Error class for API failures that can be thrown from unwrapResponse.
|
|
10189
|
-
* Preserves all error metadata from the envelope.
|
|
10190
|
-
*/
|
|
10191
|
-
var ApiEnvelopeError = class extends Error {
|
|
10192
|
-
constructor(error) {
|
|
10193
|
-
super(error.message);
|
|
10194
|
-
this.name = "ApiEnvelopeError";
|
|
10195
|
-
this.code = error.code;
|
|
10196
|
-
this.requestId = error.requestId;
|
|
10197
|
-
this.timestamp = error.timestamp;
|
|
10198
|
-
this.status = error.status;
|
|
10199
|
-
this.tag = error.tag;
|
|
10200
|
-
this.fieldErrors = error.fieldErrors;
|
|
10201
|
-
}
|
|
10202
|
-
};
|
|
10203
|
-
/**
|
|
10204
|
-
* Unwrap a successful API response or throw on error.
|
|
10205
|
-
*
|
|
10206
|
-
* @example
|
|
10207
|
-
* ```typescript
|
|
10208
|
-
* const response = await apiClient({ endpoint: 'getUser', params: { id } });
|
|
10209
|
-
* const user = unwrapResponse(response); // Throws if not success
|
|
10210
|
-
* ```
|
|
10211
|
-
*/
|
|
10212
|
-
function unwrapResponse(result) {
|
|
10213
|
-
if (isApiSuccess(result)) return result.data;
|
|
10214
|
-
throw new ApiEnvelopeError(result.error);
|
|
10215
|
-
}
|
|
10216
|
-
//#endregion
|
|
10217
|
-
//#region ../api/src/request-error.ts
|
|
10218
|
-
var ApiRequestError = class extends Error {
|
|
10219
|
-
constructor(message, options) {
|
|
10220
|
-
super(message);
|
|
10221
|
-
this.name = "ApiRequestError";
|
|
10222
|
-
this.endpoint = options.endpoint;
|
|
10223
|
-
this.status = options.status;
|
|
10224
|
-
this.method = options.method;
|
|
10225
|
-
this.auth = options.auth;
|
|
10226
|
-
this.requestId = options.requestId;
|
|
10227
|
-
this.body = options.body;
|
|
10228
|
-
this.cause = options.cause;
|
|
10229
|
-
this.errorCode = options.errorCode;
|
|
10230
|
-
this.tag = options.tag;
|
|
10231
|
-
this.retryAfterMs = options.retryAfterMs;
|
|
10232
|
-
}
|
|
10233
|
-
};
|
|
10234
|
-
//#endregion
|
|
10235
10118
|
//#region ../api/src/url.ts
|
|
10236
10119
|
function looksLikeLocalAuthority(authority) {
|
|
10237
10120
|
const normalized = authority.toLowerCase();
|
|
@@ -10283,6 +10166,171 @@ function resolveApiBaseUrl() {
|
|
|
10283
10166
|
return getCmsApiUrl();
|
|
10284
10167
|
}
|
|
10285
10168
|
//#endregion
|
|
10169
|
+
//#region ../api/src/pageReadResponseCache.ts
|
|
10170
|
+
function isRecord(value) {
|
|
10171
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
10172
|
+
}
|
|
10173
|
+
function isResolvedPage(page) {
|
|
10174
|
+
return page?.kind === "resolved" && typeof page.requestedPath === "string" && (page.dependencies === "content" || page.dependencies === "availability") && isRecord(page.result) && [
|
|
10175
|
+
"cms",
|
|
10176
|
+
"system_event",
|
|
10177
|
+
"system_service"
|
|
10178
|
+
].includes(String(page.result.kind));
|
|
10179
|
+
}
|
|
10180
|
+
function envelopePage(body) {
|
|
10181
|
+
const data = isRecord(body) && body.success === true && isRecord(body.data) ? body.data : null;
|
|
10182
|
+
return data?.type === "content" && isRecord(data.content) ? data.content : data;
|
|
10183
|
+
}
|
|
10184
|
+
function parseBody(body) {
|
|
10185
|
+
try {
|
|
10186
|
+
return JSON.parse(body);
|
|
10187
|
+
} catch {
|
|
10188
|
+
return null;
|
|
10189
|
+
}
|
|
10190
|
+
}
|
|
10191
|
+
const header = (snapshot, name) => snapshot.headers.find(([key]) => key.toLowerCase() === name)?.[1];
|
|
10192
|
+
/** Only a complete, resolved page is stored. Anything else passes through and keeps the policy its failure names. */
|
|
10193
|
+
function admit(snapshot) {
|
|
10194
|
+
const page = envelopePage(parseBody(snapshot.body));
|
|
10195
|
+
if (snapshot.status === 200 && isResolvedPage(page)) {
|
|
10196
|
+
if (header(snapshot, "x-riverbank-page-storage") === "no-store") return {
|
|
10197
|
+
kind: "pass-through",
|
|
10198
|
+
dependencies: "availability"
|
|
10199
|
+
};
|
|
10200
|
+
return {
|
|
10201
|
+
kind: "store",
|
|
10202
|
+
dependencies: page.dependencies
|
|
10203
|
+
};
|
|
10204
|
+
}
|
|
10205
|
+
return {
|
|
10206
|
+
kind: "pass-through",
|
|
10207
|
+
dependencies: snapshot.status === 200 || header(snapshot, "x-riverbank-page-dependencies") === "availability" ? "availability" : "content"
|
|
10208
|
+
};
|
|
10209
|
+
}
|
|
10210
|
+
/**
|
|
10211
|
+
* One cache entry per request, judged by the policy it is looked up with. Content is looked up first, so a
|
|
10212
|
+
* plain page costs one lookup and never registers the availability policy. A page whose snapshot depends on
|
|
10213
|
+
* availability is looked up again under that policy, which checks its tags and 60-second budget. A snapshot
|
|
10214
|
+
* past its own budget is never served: the live read replaces it.
|
|
10215
|
+
*/
|
|
10216
|
+
function planPageRead(state, now, budgetSeconds) {
|
|
10217
|
+
const subject = state.live ?? state.cached;
|
|
10218
|
+
if (!subject) return {
|
|
10219
|
+
kind: "lookup",
|
|
10220
|
+
dependencies: "content"
|
|
10221
|
+
};
|
|
10222
|
+
const { dependencies } = admit(subject);
|
|
10223
|
+
if (!state.lookedUp.includes(dependencies)) return {
|
|
10224
|
+
kind: "lookup",
|
|
10225
|
+
dependencies
|
|
10226
|
+
};
|
|
10227
|
+
if (state.live) return {
|
|
10228
|
+
kind: "serve",
|
|
10229
|
+
snapshot: state.live
|
|
10230
|
+
};
|
|
10231
|
+
return now - subject.cachedAt < budgetSeconds(dependencies) * 1e3 ? {
|
|
10232
|
+
kind: "serve",
|
|
10233
|
+
snapshot: subject
|
|
10234
|
+
} : { kind: "read-live" };
|
|
10235
|
+
}
|
|
10236
|
+
/**
|
|
10237
|
+
* `unstable_cache` stores whatever its callback returns, so a response that must not be kept leaves the
|
|
10238
|
+
* callback by this one exception, which `lookup` turns back into a value straight away.
|
|
10239
|
+
*/
|
|
10240
|
+
var PassThroughResponse = class extends Error {
|
|
10241
|
+
constructor(snapshot) {
|
|
10242
|
+
super("Page read must not be stored");
|
|
10243
|
+
this.snapshot = snapshot;
|
|
10244
|
+
}
|
|
10245
|
+
};
|
|
10246
|
+
async function lookup(input, dependencies) {
|
|
10247
|
+
const { tags } = buildPageReadCachePolicy(input.siteId, dependencies);
|
|
10248
|
+
const load = async () => {
|
|
10249
|
+
const snapshot = await input.live();
|
|
10250
|
+
if (admit(snapshot).kind === "pass-through") throw new PassThroughResponse(snapshot);
|
|
10251
|
+
return snapshot;
|
|
10252
|
+
};
|
|
10253
|
+
try {
|
|
10254
|
+
return {
|
|
10255
|
+
cached: await input.cache(load, ["page-read-envelope-v3", input.key], {
|
|
10256
|
+
revalidate: input.budgetSeconds(dependencies),
|
|
10257
|
+
tags
|
|
10258
|
+
})(),
|
|
10259
|
+
live: null
|
|
10260
|
+
};
|
|
10261
|
+
} catch (error) {
|
|
10262
|
+
if (error instanceof PassThroughResponse) return {
|
|
10263
|
+
cached: null,
|
|
10264
|
+
live: error.snapshot
|
|
10265
|
+
};
|
|
10266
|
+
throw error;
|
|
10267
|
+
}
|
|
10268
|
+
}
|
|
10269
|
+
async function runPlan(input, state) {
|
|
10270
|
+
const step = planPageRead(state, Date.now(), input.budgetSeconds);
|
|
10271
|
+
switch (step.kind) {
|
|
10272
|
+
case "serve": return step.snapshot;
|
|
10273
|
+
case "read-live": return runPlan(input, {
|
|
10274
|
+
...state,
|
|
10275
|
+
live: await input.live()
|
|
10276
|
+
});
|
|
10277
|
+
case "lookup": {
|
|
10278
|
+
const found = await lookup(input, step.dependencies);
|
|
10279
|
+
return runPlan(input, {
|
|
10280
|
+
lookedUp: [...state.lookedUp, step.dependencies],
|
|
10281
|
+
cached: found.cached ?? state.cached,
|
|
10282
|
+
live: state.live ?? found.live
|
|
10283
|
+
});
|
|
10284
|
+
}
|
|
10285
|
+
}
|
|
10286
|
+
}
|
|
10287
|
+
/**
|
|
10288
|
+
* One transport read per page read, shared by a miss, a stale entry's refresh and the live fallback.
|
|
10289
|
+
* It starts only when one of them asks for it.
|
|
10290
|
+
*/
|
|
10291
|
+
function sharedRead(read) {
|
|
10292
|
+
const transport = { started: null };
|
|
10293
|
+
return () => transport.started ?? (transport.started = read().then(async (value) => ({
|
|
10294
|
+
body: await value.text(),
|
|
10295
|
+
status: value.status,
|
|
10296
|
+
headers: [...value.headers.entries()],
|
|
10297
|
+
cachedAt: Date.now()
|
|
10298
|
+
})));
|
|
10299
|
+
}
|
|
10300
|
+
async function cachePageReadResponse(input) {
|
|
10301
|
+
if (!input.cache || input.maxAge !== void 0 && input.maxAge <= 0) return input.read();
|
|
10302
|
+
const maxAge = input.maxAge;
|
|
10303
|
+
const budgetSeconds = (dependencies) => {
|
|
10304
|
+
const policy = buildPageReadCachePolicy(input.siteId, dependencies).revalidate;
|
|
10305
|
+
return maxAge === void 0 ? policy : Math.min(policy, maxAge);
|
|
10306
|
+
};
|
|
10307
|
+
const result = await runPlan({
|
|
10308
|
+
cache: input.cache,
|
|
10309
|
+
key: input.key,
|
|
10310
|
+
siteId: input.siteId,
|
|
10311
|
+
live: sharedRead(input.read),
|
|
10312
|
+
budgetSeconds
|
|
10313
|
+
}, {
|
|
10314
|
+
lookedUp: [],
|
|
10315
|
+
cached: null,
|
|
10316
|
+
live: null
|
|
10317
|
+
});
|
|
10318
|
+
return new Response(result.body, {
|
|
10319
|
+
status: result.status,
|
|
10320
|
+
headers: result.headers
|
|
10321
|
+
});
|
|
10322
|
+
}
|
|
10323
|
+
/** Result adapters use this when the SDK served a page without the HTTP transport (memory, durable or prebuild fallback). */
|
|
10324
|
+
async function observePageReadPolicy(cache, siteId, payload) {
|
|
10325
|
+
if (!cache) return;
|
|
10326
|
+
const dependency = pageReadDependencies(payload);
|
|
10327
|
+
await cache(async () => true, [
|
|
10328
|
+
"page-read-policy-v2",
|
|
10329
|
+
siteId,
|
|
10330
|
+
dependency
|
|
10331
|
+
], buildPageReadCachePolicy(siteId, dependency))();
|
|
10332
|
+
}
|
|
10333
|
+
//#endregion
|
|
10286
10334
|
//#region ../api/src/common/operationId.ts
|
|
10287
10335
|
const OPERATION_ID_HEADER = "X-Riverbank-Operation-Id";
|
|
10288
10336
|
z.uuid();
|
|
@@ -10353,18 +10401,9 @@ z.enum([
|
|
|
10353
10401
|
]);
|
|
10354
10402
|
//#endregion
|
|
10355
10403
|
//#region ../api/src/request.ts
|
|
10356
|
-
|
|
10357
|
-
|
|
10358
|
-
|
|
10359
|
-
if (revalidateTagResolved) return revalidateTag;
|
|
10360
|
-
revalidateTagResolved = true;
|
|
10361
|
-
if (typeof window !== "undefined") return null;
|
|
10362
|
-
try {
|
|
10363
|
-
revalidateTag = new Function("modulePath", "return require(modulePath)")("next/cache").revalidateTag ?? null;
|
|
10364
|
-
} catch {
|
|
10365
|
-
revalidateTag = null;
|
|
10366
|
-
}
|
|
10367
|
-
return revalidateTag;
|
|
10404
|
+
/** Preserve the returned dependency even when the SDK served a durable fallback. */
|
|
10405
|
+
function observePageReadResponse(adapter, siteId, payload) {
|
|
10406
|
+
return observePageReadPolicy(adapter?.cache ?? null, siteId, payload);
|
|
10368
10407
|
}
|
|
10369
10408
|
/**
|
|
10370
10409
|
* Generate a UUID, with fallback for environments where crypto.randomUUID isn't available.
|
|
@@ -10454,8 +10493,8 @@ function serializePathParam(endpoint, key, value) {
|
|
|
10454
10493
|
if (typeof value === "string") return value;
|
|
10455
10494
|
throw new Error(`Invalid path param for endpoint ${String(endpoint)}: ${key} must be a string`);
|
|
10456
10495
|
}
|
|
10457
|
-
function invalidateCacheTags(tags, params) {
|
|
10458
|
-
const resolved =
|
|
10496
|
+
function invalidateCacheTags(adapter, tags, params) {
|
|
10497
|
+
const resolved = adapter?.invalidateTag;
|
|
10459
10498
|
if (typeof window !== "undefined" || !resolved || !tags) return;
|
|
10460
10499
|
tags.forEach((tag) => {
|
|
10461
10500
|
let processedTag = tag;
|
|
@@ -10463,7 +10502,7 @@ function invalidateCacheTags(tags, params) {
|
|
|
10463
10502
|
processedTag = processedTag.replace(`{${key}}`, String(value));
|
|
10464
10503
|
});
|
|
10465
10504
|
try {
|
|
10466
|
-
resolved(processedTag
|
|
10505
|
+
resolved(processedTag);
|
|
10467
10506
|
} catch {}
|
|
10468
10507
|
});
|
|
10469
10508
|
}
|
|
@@ -10535,7 +10574,14 @@ async function parseJsonSuccess(endpoint, response, config, decoder) {
|
|
|
10535
10574
|
if (!raw.trim()) return buildSuccessEnvelope(coerceResponse(void 0), requestId);
|
|
10536
10575
|
const parsed = decodeSuccessJson(raw, endpoint, response, config, decoder);
|
|
10537
10576
|
requireUsableCommitProjection(response, parsed);
|
|
10538
|
-
|
|
10577
|
+
const envelope = successJsonEnvelope(parsed, requestId);
|
|
10578
|
+
return envelope.success && response.headers.get("x-riverbank-page-storage") === "no-store" ? {
|
|
10579
|
+
...envelope,
|
|
10580
|
+
meta: {
|
|
10581
|
+
...envelope.meta,
|
|
10582
|
+
storage: "no-store"
|
|
10583
|
+
}
|
|
10584
|
+
} : envelope;
|
|
10539
10585
|
}
|
|
10540
10586
|
function decodeSuccessJson(raw, endpoint, response, config, decoder) {
|
|
10541
10587
|
try {
|
|
@@ -10556,7 +10602,7 @@ function successJsonEnvelope(parsed, requestId) {
|
|
|
10556
10602
|
if (parsed && typeof parsed === "object" && "success" in parsed && typeof parsed.success === "boolean") return parsed;
|
|
10557
10603
|
return buildSuccessEnvelope(coerceResponse(parsed), requestId);
|
|
10558
10604
|
}
|
|
10559
|
-
function createApiResponseTransport(getHeaders = () => ({}), baseUrl, { sdkVersion } = {}) {
|
|
10605
|
+
function createApiResponseTransport(getHeaders = () => ({}), baseUrl, { sdkVersion, frameworkCache } = {}) {
|
|
10560
10606
|
return ({ endpoint, body, params, options = {} }) => {
|
|
10561
10607
|
const plan = buildApiRequestPlan({
|
|
10562
10608
|
endpoint,
|
|
@@ -10570,14 +10616,31 @@ function createApiResponseTransport(getHeaders = () => ({}), baseUrl, { sdkVersi
|
|
|
10570
10616
|
baseUrl: normalizeCmsApiBaseUrl(baseUrl ?? resolveApiBaseUrl()),
|
|
10571
10617
|
sdkVersion
|
|
10572
10618
|
});
|
|
10573
|
-
const fetchPromise =
|
|
10619
|
+
const fetchPromise = executeApiRequest(plan, endpoint, params, options, frameworkCache);
|
|
10574
10620
|
if (plan.cacheInvalidationTags) return fetchPromise.then((response) => {
|
|
10575
|
-
if (response.ok) invalidateCacheTags(plan.cacheInvalidationTags, params);
|
|
10621
|
+
if (response.ok) invalidateCacheTags(frameworkCache, plan.cacheInvalidationTags, params);
|
|
10576
10622
|
return response;
|
|
10577
10623
|
});
|
|
10578
10624
|
return fetchPromise;
|
|
10579
10625
|
};
|
|
10580
10626
|
}
|
|
10627
|
+
function isPublishedPageRead(endpoint, params, options) {
|
|
10628
|
+
return (endpoint === "getContentByPath" || endpoint === "resolveRouteOutcome") && params?.preview !== true && params?.preview !== "true" && options.cache !== "no-store";
|
|
10629
|
+
}
|
|
10630
|
+
function executeApiRequest(plan, endpoint, params, options, frameworkCache) {
|
|
10631
|
+
const inputParams = params;
|
|
10632
|
+
const { next: fetchPolicy, ...uncachedInit } = plan.init;
|
|
10633
|
+
return isPublishedPageRead(endpoint, inputParams, options) ? cachePageReadResponse({
|
|
10634
|
+
cache: frameworkCache?.cache ?? null,
|
|
10635
|
+
key: JSON.stringify([plan.url, [...new Headers(plan.init.headers).entries()]]),
|
|
10636
|
+
siteId: typeof inputParams?.siteId === "string" ? inputParams.siteId : "",
|
|
10637
|
+
maxAge: typeof fetchPolicy?.revalidate === "number" ? fetchPolicy.revalidate : void 0,
|
|
10638
|
+
read: () => fetch(plan.url, {
|
|
10639
|
+
...uncachedInit,
|
|
10640
|
+
cache: "no-store"
|
|
10641
|
+
})
|
|
10642
|
+
}) : fetch(plan.url, plan.init);
|
|
10643
|
+
}
|
|
10581
10644
|
const batchReadPolicyBodySchema = z.object({ requests: z.array(z.object({
|
|
10582
10645
|
endpoint: z.string(),
|
|
10583
10646
|
params: z.record(z.string(), z.unknown()).optional()
|
|
@@ -10611,10 +10674,12 @@ function batchReadRequestOptions(params, body, options) {
|
|
|
10611
10674
|
function publicReadRequestOptions(endpoint, params, body, options) {
|
|
10612
10675
|
if (endpoint === "batchBlockLoaders") return batchReadRequestOptions(params, body, options);
|
|
10613
10676
|
const preview = params?.preview === true || params?.preview === "true";
|
|
10614
|
-
|
|
10677
|
+
if (endpoint !== "getContentByPath" && endpoint !== "resolveRouteOutcome") return options;
|
|
10678
|
+
if (preview) return {
|
|
10615
10679
|
...options,
|
|
10616
10680
|
cache: "no-store"
|
|
10617
|
-
}
|
|
10681
|
+
};
|
|
10682
|
+
return options;
|
|
10618
10683
|
}
|
|
10619
10684
|
function assertResolvedEndpointPath(endpoint, url) {
|
|
10620
10685
|
const tokens = [...url.match(/\{[^}]+\}/g) ?? [], ...url.match(/(^|\/):([A-Za-z][A-Za-z0-9_]*)\b/g) ?? []];
|
|
@@ -10717,194 +10782,6 @@ function requireUsableCommitProjection(response, parsed) {
|
|
|
10717
10782
|
throw new ApiCommittedWriteNotice(pageCommitConfirmationEnvelopeSchema.parse(parsed).data);
|
|
10718
10783
|
}
|
|
10719
10784
|
//#endregion
|
|
10720
|
-
//#region src/client/error.ts
|
|
10721
|
-
let _Symbol$for;
|
|
10722
|
-
_Symbol$for = Symbol.for("nodejs.util.inspect.custom");
|
|
10723
|
-
/**
|
|
10724
|
-
* Error thrown by SDK when API returns an error response
|
|
10725
|
-
*
|
|
10726
|
-
* @example
|
|
10727
|
-
* ```ts
|
|
10728
|
-
* try {
|
|
10729
|
-
* await client.getSite({ slug: 'my-site' });
|
|
10730
|
-
* } catch (error) {
|
|
10731
|
-
* if (error instanceof RiverbankApiError) {
|
|
10732
|
-
* console.log('Error code:', error.code);
|
|
10733
|
-
* console.log('Request ID:', error.requestId);
|
|
10734
|
-
*
|
|
10735
|
-
* if (error.isAuthError()) {
|
|
10736
|
-
* // Handle authentication error
|
|
10737
|
-
* }
|
|
10738
|
-
*
|
|
10739
|
-
* if (error.isValidationError() && error.fieldErrors) {
|
|
10740
|
-
* // Handle field-level validation errors
|
|
10741
|
-
* error.fieldErrors.forEach(fe => {
|
|
10742
|
-
* console.log(`${fe.field}: ${fe.message}`);
|
|
10743
|
-
* });
|
|
10744
|
-
* }
|
|
10745
|
-
*
|
|
10746
|
-
* // Check if error can be retried
|
|
10747
|
-
* if (error.isRetryable) {
|
|
10748
|
-
* const delay = error.retryAfterMs ?? 1000;
|
|
10749
|
-
* console.log(`Retrying after ${delay}ms...`);
|
|
10750
|
-
* }
|
|
10751
|
-
* }
|
|
10752
|
-
* }
|
|
10753
|
-
* ```
|
|
10754
|
-
*/
|
|
10755
|
-
var RiverbankApiError = class RiverbankApiError extends Error {
|
|
10756
|
-
constructor(apiError) {
|
|
10757
|
-
super(apiError.message);
|
|
10758
|
-
this.name = "RiverbankApiError";
|
|
10759
|
-
if ("cause" in apiError && apiError.cause) this.cause = apiError.cause;
|
|
10760
|
-
this.code = apiError.code;
|
|
10761
|
-
this.requestId = apiError.requestId;
|
|
10762
|
-
this.status = apiError.status;
|
|
10763
|
-
this.fieldErrors = apiError.fieldErrors;
|
|
10764
|
-
this.timestamp = apiError.timestamp;
|
|
10765
|
-
this.retryAfterMs = "retryAfterMs" in apiError ? apiError.retryAfterMs : void 0;
|
|
10766
|
-
this.isRetryable = this.computeRetryable();
|
|
10767
|
-
Object.setPrototypeOf(this, RiverbankApiError.prototype);
|
|
10768
|
-
}
|
|
10769
|
-
/**
|
|
10770
|
-
* Compute whether this error is retryable based on HTTP status code.
|
|
10771
|
-
* - 0 (network errors - no HTTP response): retryable
|
|
10772
|
-
* - 429 (rate limit): retryable
|
|
10773
|
-
* - 5xx (server errors): retryable
|
|
10774
|
-
* - 4xx (client errors, except 429): NOT retryable
|
|
10775
|
-
*/
|
|
10776
|
-
computeRetryable() {
|
|
10777
|
-
if (this.status === 0) return true;
|
|
10778
|
-
if (this.status === 429) return true;
|
|
10779
|
-
if (this.status >= 500) return true;
|
|
10780
|
-
return false;
|
|
10781
|
-
}
|
|
10782
|
-
/**
|
|
10783
|
-
* Check if this is a network error (no HTTP response received)
|
|
10784
|
-
*
|
|
10785
|
-
* Matches: network:connection_error, network:timeout, network:dns_error
|
|
10786
|
-
*/
|
|
10787
|
-
isNetworkError() {
|
|
10788
|
-
return this.code.startsWith("network:");
|
|
10789
|
-
}
|
|
10790
|
-
/**
|
|
10791
|
-
* Check if this error matches a specific error code
|
|
10792
|
-
*
|
|
10793
|
-
* @example
|
|
10794
|
-
* ```ts
|
|
10795
|
-
* if (error.is('auth:unauthenticated')) {
|
|
10796
|
-
* // Redirect to login
|
|
10797
|
-
* }
|
|
10798
|
-
* ```
|
|
10799
|
-
*/
|
|
10800
|
-
is(code) {
|
|
10801
|
-
return this.code === code;
|
|
10802
|
-
}
|
|
10803
|
-
/**
|
|
10804
|
-
* Check if this is an authentication or authorization error
|
|
10805
|
-
*
|
|
10806
|
-
* Matches: auth:unauthenticated, auth:token_expired, auth:token_invalid,
|
|
10807
|
-
* auth:forbidden, auth:mfa_required, auth:insufficient_permissions
|
|
10808
|
-
*/
|
|
10809
|
-
isAuthError() {
|
|
10810
|
-
return this.code.startsWith("auth:");
|
|
10811
|
-
}
|
|
10812
|
-
/**
|
|
10813
|
-
* Check if this is a validation error
|
|
10814
|
-
*
|
|
10815
|
-
* Matches: validation:invalid_input, validation:missing_field, validation:invalid_format
|
|
10816
|
-
*/
|
|
10817
|
-
isValidationError() {
|
|
10818
|
-
return this.code.startsWith("validation:");
|
|
10819
|
-
}
|
|
10820
|
-
/**
|
|
10821
|
-
* Check if this is a resource error (not found, conflict, etc.)
|
|
10822
|
-
*
|
|
10823
|
-
* Matches: resource:not_found, resource:already_exists, resource:conflict, resource:gone
|
|
10824
|
-
*/
|
|
10825
|
-
isResourceError() {
|
|
10826
|
-
return this.code.startsWith("resource:");
|
|
10827
|
-
}
|
|
10828
|
-
/**
|
|
10829
|
-
* Check if this is a rate limiting error
|
|
10830
|
-
*/
|
|
10831
|
-
isRateLimitError() {
|
|
10832
|
-
return this.code.startsWith("rate_limit:");
|
|
10833
|
-
}
|
|
10834
|
-
/**
|
|
10835
|
-
* Check if this is a billing/payment error
|
|
10836
|
-
*/
|
|
10837
|
-
isBillingError() {
|
|
10838
|
-
return this.code.startsWith("billing:");
|
|
10839
|
-
}
|
|
10840
|
-
/**
|
|
10841
|
-
* Check if this is a server error
|
|
10842
|
-
*/
|
|
10843
|
-
isServerError() {
|
|
10844
|
-
return this.code.startsWith("server:");
|
|
10845
|
-
}
|
|
10846
|
-
/**
|
|
10847
|
-
* Returns a human-readable string representation of the error.
|
|
10848
|
-
* Includes all key details for debugging.
|
|
10849
|
-
*
|
|
10850
|
-
* @example
|
|
10851
|
-
* "RiverbankApiError: Content keys cannot access preview content | Code: auth:forbidden | Status: 401 | RequestId: req-abc123"
|
|
10852
|
-
*/
|
|
10853
|
-
toString() {
|
|
10854
|
-
const parts = [`RiverbankApiError: ${this.message}`];
|
|
10855
|
-
if (this.code) parts.push(`Code: ${this.code}`);
|
|
10856
|
-
if (this.status) parts.push(`Status: ${this.status}`);
|
|
10857
|
-
if (this.requestId) parts.push(`RequestId: ${this.requestId}`);
|
|
10858
|
-
return parts.join(" | ");
|
|
10859
|
-
}
|
|
10860
|
-
/**
|
|
10861
|
-
* Custom Node.js inspect output for better console.log display.
|
|
10862
|
-
* This ensures that console.log(error) shows all relevant details
|
|
10863
|
-
* instead of just "[Object]" for nested properties.
|
|
10864
|
-
*/
|
|
10865
|
-
[_Symbol$for]() {
|
|
10866
|
-
return this.toDetailedString();
|
|
10867
|
-
}
|
|
10868
|
-
/**
|
|
10869
|
-
* Returns a detailed multi-line string for debugging.
|
|
10870
|
-
* Used by the Node.js inspect symbol for console output.
|
|
10871
|
-
*/
|
|
10872
|
-
toDetailedString() {
|
|
10873
|
-
const lines = [
|
|
10874
|
-
`RiverbankApiError: ${this.message}`,
|
|
10875
|
-
` Code: ${this.code}`,
|
|
10876
|
-
` Status: ${this.status}`,
|
|
10877
|
-
` RequestId: ${this.requestId}`,
|
|
10878
|
-
` Timestamp: ${this.timestamp}`
|
|
10879
|
-
];
|
|
10880
|
-
if (this.isRetryable) {
|
|
10881
|
-
lines.push(` Retryable: true`);
|
|
10882
|
-
if (this.retryAfterMs) lines.push(` RetryAfter: ${this.retryAfterMs}ms`);
|
|
10883
|
-
}
|
|
10884
|
-
if (this.fieldErrors && this.fieldErrors.length > 0) {
|
|
10885
|
-
lines.push(" FieldErrors:");
|
|
10886
|
-
this.fieldErrors.forEach((fe) => {
|
|
10887
|
-
lines.push(` - ${fe.field}: ${fe.message}`);
|
|
10888
|
-
});
|
|
10889
|
-
}
|
|
10890
|
-
return lines.join("\n");
|
|
10891
|
-
}
|
|
10892
|
-
};
|
|
10893
|
-
const resilienceStatusSymbol = Symbol.for("riverbankcms.sdk.resilienceStatus");
|
|
10894
|
-
function attachResilienceStatusToError(error, resilienceStatus) {
|
|
10895
|
-
const target = error !== null && (typeof error === "object" || typeof error === "function") ? error : new Error(typeof error === "string" || typeof error === "number" || typeof error === "boolean" || typeof error === "bigint" ? String(error) : "Unknown error");
|
|
10896
|
-
Object.defineProperty(target, resilienceStatusSymbol, {
|
|
10897
|
-
configurable: true,
|
|
10898
|
-
enumerable: false,
|
|
10899
|
-
value: resilienceStatus
|
|
10900
|
-
});
|
|
10901
|
-
return target;
|
|
10902
|
-
}
|
|
10903
|
-
function getResilienceStatusFromError(error) {
|
|
10904
|
-
if (error === null || typeof error !== "object" && typeof error !== "function") return;
|
|
10905
|
-
return error[resilienceStatusSymbol];
|
|
10906
|
-
}
|
|
10907
|
-
//#endregion
|
|
10908
10785
|
//#region src/client/resilience.ts
|
|
10909
10786
|
const DEFAULT_RETRY_CONFIG = {
|
|
10910
10787
|
maxAttempts: 3,
|
|
@@ -11160,6 +11037,7 @@ function isAbortError$1(error) {
|
|
|
11160
11037
|
*/
|
|
11161
11038
|
function shouldRetryError(error, customRetryOn) {
|
|
11162
11039
|
if (isAbortError$1(error)) return false;
|
|
11040
|
+
if (findFrameworkSignal(error) !== void 0) return false;
|
|
11163
11041
|
if (customRetryOn) return customRetryOn(error, error instanceof RiverbankApiError ? error.status : void 0);
|
|
11164
11042
|
return isTransientError(error);
|
|
11165
11043
|
}
|
|
@@ -11195,7 +11073,7 @@ function restoreRuntimeResponse(serialized) {
|
|
|
11195
11073
|
//#endregion
|
|
11196
11074
|
//#region ../site-renderer/src/runtimeClient.ts
|
|
11197
11075
|
/** Only a client that reconstructs surfaces advertises revision transport. */
|
|
11198
|
-
function createRuntimeApiClient(transport) {
|
|
11076
|
+
function createRuntimeApiClient$1(transport) {
|
|
11199
11077
|
const revisionTransport = (request) => transport({
|
|
11200
11078
|
...request,
|
|
11201
11079
|
...request.endpoint === "getContentByPath" ? { params: {
|
|
@@ -11209,10 +11087,10 @@ function createRuntimeApiClient(transport) {
|
|
|
11209
11087
|
});
|
|
11210
11088
|
}
|
|
11211
11089
|
function createRuntimeInternalAPIClient(baseUrl, options) {
|
|
11212
|
-
return createRuntimeApiClient(createApiResponseTransport(() => ({}), baseUrl, options));
|
|
11090
|
+
return createRuntimeApiClient$1(createApiResponseTransport(() => ({}), baseUrl, options));
|
|
11213
11091
|
}
|
|
11214
11092
|
function createRuntimeBearerAPIClient(token, baseUrl, options) {
|
|
11215
|
-
return createRuntimeApiClient(createApiResponseTransport(() => ({ Authorization: `Bearer ${typeof token === "function" ? token() : token}` }), baseUrl, options));
|
|
11093
|
+
return createRuntimeApiClient$1(createApiResponseTransport(() => ({ Authorization: `Bearer ${typeof token === "function" ? token() : token}` }), baseUrl, options));
|
|
11216
11094
|
}
|
|
11217
11095
|
//#endregion
|
|
11218
11096
|
//#region src/client/entryListReadRequest.ts
|
|
@@ -11390,7 +11268,6 @@ const PUBLIC_ENDPOINT_NAMES = [
|
|
|
11390
11268
|
"listPublicProducts",
|
|
11391
11269
|
"listPublicPasses",
|
|
11392
11270
|
"listPublicMemberships",
|
|
11393
|
-
"resolveEventSubroute",
|
|
11394
11271
|
"checkRedirect",
|
|
11395
11272
|
"getRoutableContent",
|
|
11396
11273
|
"getPublicRoutableContent",
|
|
@@ -11410,6 +11287,7 @@ const API_ENDPOINTS = Object.freeze({
|
|
|
11410
11287
|
responseKind: "json"
|
|
11411
11288
|
},
|
|
11412
11289
|
resolveRouteOutcome: {
|
|
11290
|
+
revalidate: PUBLIC_CONTENT_FRESHNESS_SECONDS,
|
|
11413
11291
|
path: "/sites/{siteId}/route-outcome",
|
|
11414
11292
|
method: "GET",
|
|
11415
11293
|
tags: [
|
|
@@ -11531,14 +11409,6 @@ const API_ENDPOINTS = Object.freeze({
|
|
|
11531
11409
|
auth: "public",
|
|
11532
11410
|
responseKind: "json"
|
|
11533
11411
|
},
|
|
11534
|
-
resolveEventSubroute: {
|
|
11535
|
-
path: "/public/sites/{siteId}/events/subroutes/resolve",
|
|
11536
|
-
method: "GET",
|
|
11537
|
-
revalidate: 60,
|
|
11538
|
-
tags: [TAG_TEMPLATES.publicEvents, "event-subroute"],
|
|
11539
|
-
auth: "public",
|
|
11540
|
-
responseKind: "json"
|
|
11541
|
-
},
|
|
11542
11412
|
checkRedirect: publicSiteReadDefinition(PUBLIC_READ_ENDPOINT_DEFINITIONS.checkRedirect)
|
|
11543
11413
|
});
|
|
11544
11414
|
function buildEndpointURL(baseURL, endpoint) {
|
|
@@ -11561,12 +11431,13 @@ function publicSiteReadDefinition(definition) {
|
|
|
11561
11431
|
* entries written in the old shape until publish or a live success rewrites
|
|
11562
11432
|
* them.
|
|
11563
11433
|
*
|
|
11434
|
+
* - 5: page reads carry the admitted destination envelope and availability dependencies.
|
|
11564
11435
|
* - 4: owned surface inputs use the shared revision transport envelope (#1627).
|
|
11565
11436
|
* - 3: hidden business-source maps and private locations are removed before public projection (#1611).
|
|
11566
11437
|
* - 2: pages carry intent-only `runtimeJoins` in place of compiled
|
|
11567
11438
|
* `runtimeBoundaries` (issue 1422).
|
|
11568
11439
|
*/
|
|
11569
|
-
const DEFAULT_PUBLISHED_RUNTIME_CACHE_PAYLOAD_SCHEMA_VERSION =
|
|
11440
|
+
const DEFAULT_PUBLISHED_RUNTIME_CACHE_PAYLOAD_SCHEMA_VERSION = 5;
|
|
11570
11441
|
function toNonEmptyString(value) {
|
|
11571
11442
|
if (value === null || value === void 0) return null;
|
|
11572
11443
|
if (typeof value !== "string" && typeof value !== "number" && typeof value !== "boolean") return null;
|
|
@@ -11818,10 +11689,6 @@ const RUNTIME_CACHE_DURABILITY_OVERRIDES = {
|
|
|
11818
11689
|
kind: "live-only",
|
|
11819
11690
|
reason: "safety_sensitive_booking"
|
|
11820
11691
|
},
|
|
11821
|
-
resolveEventSubroute: {
|
|
11822
|
-
kind: "memory-only",
|
|
11823
|
-
reason: "durable_rollout_pending"
|
|
11824
|
-
},
|
|
11825
11692
|
checkRedirect: {
|
|
11826
11693
|
kind: "memory-only",
|
|
11827
11694
|
reason: "durable_rollout_pending"
|
|
@@ -11848,7 +11715,7 @@ function isTruthyParam(value) {
|
|
|
11848
11715
|
}
|
|
11849
11716
|
function isPreviewRequest(endpoint, params) {
|
|
11850
11717
|
if (endpoint === "getContentByPath") return isTruthyParam(params.preview);
|
|
11851
|
-
if (endpoint === "listPublishedEntries"
|
|
11718
|
+
if (endpoint === "listPublishedEntries") return params.stage === "preview";
|
|
11852
11719
|
return false;
|
|
11853
11720
|
}
|
|
11854
11721
|
function getEndpointFreshTtlSec(endpoint) {
|
|
@@ -12045,7 +11912,7 @@ async function readPageWithResilience(input, params) {
|
|
|
12045
11912
|
siteId
|
|
12046
11913
|
});
|
|
12047
11914
|
const cacheKey = publishedRuntimeCache?.cacheKey ?? `page:${siteId}:${path}:${preview}`;
|
|
12048
|
-
|
|
11915
|
+
const result = await input.resilientFetch(cacheKey, (requestSignal) => input.apiClient({
|
|
12049
11916
|
endpoint: "getContentByPath",
|
|
12050
11917
|
params: {
|
|
12051
11918
|
siteId,
|
|
@@ -12054,12 +11921,15 @@ async function readPageWithResilience(input, params) {
|
|
|
12054
11921
|
},
|
|
12055
11922
|
options: { signal: requestSignal }
|
|
12056
11923
|
}), {
|
|
11924
|
+
pageRead: { siteId },
|
|
12057
11925
|
preview,
|
|
12058
11926
|
signal,
|
|
12059
11927
|
publishedRuntimeCache,
|
|
12060
11928
|
cacheTags: buildSiteReadTags({ siteId }),
|
|
12061
11929
|
prebuildFallback: void 0
|
|
12062
11930
|
});
|
|
11931
|
+
if (!preview && result.resilience.source !== "live") await observePageReadResponse(input.frameworkCache, siteId, result.data);
|
|
11932
|
+
return result;
|
|
12063
11933
|
}
|
|
12064
11934
|
function createContentReadOperations(input) {
|
|
12065
11935
|
return {
|
|
@@ -12124,50 +11994,19 @@ function createPublicAppointmentReadOperations(deps) {
|
|
|
12124
11994
|
//#endregion
|
|
12125
11995
|
//#region src/client/publicEventReadOperations.ts
|
|
12126
11996
|
function createPublicEventReadOperations(deps) {
|
|
12127
|
-
async
|
|
12128
|
-
|
|
12129
|
-
|
|
12130
|
-
const subjectId = subject.kind === "eventOffering" ? subject.eventOfferingId : subject.eventSeriesId;
|
|
12131
|
-
return deps.resilientFetchData("resolveEventSubroute", `${kind}:${siteId}:${subject.kind}:${subjectId}:${segment}:${preview ? "preview" : "published"}`, (requestSignal) => deps.apiClient({
|
|
12132
|
-
endpoint: "resolveEventSubroute",
|
|
11997
|
+
return { async listPublicEventCalendarWindow({ signal, ...params }) {
|
|
11998
|
+
return deps.resilientFetchData("listPublicEventCalendarWindow", `public-calendar-window:${JSON.stringify(params)}`, (requestSignal) => deps.apiClient({
|
|
11999
|
+
endpoint: "listPublicEventCalendarWindow",
|
|
12133
12000
|
params: {
|
|
12134
|
-
|
|
12135
|
-
|
|
12136
|
-
subjectKind: subject.kind,
|
|
12137
|
-
subjectId,
|
|
12138
|
-
segment,
|
|
12139
|
-
stage: preview ? "preview" : "published"
|
|
12001
|
+
...params,
|
|
12002
|
+
limit: params.limit === void 0 ? void 0 : String(params.limit)
|
|
12140
12003
|
},
|
|
12141
12004
|
options: { signal: requestSignal }
|
|
12142
12005
|
}), {
|
|
12143
12006
|
signal,
|
|
12144
|
-
|
|
12145
|
-
cacheTags: buildPublicReadMemoryCacheTags("resolveEventSubroute", { siteId })
|
|
12007
|
+
cacheTags: buildPublicReadMemoryCacheTags("listPublicEventCalendarWindow", { siteId: params.siteId })
|
|
12146
12008
|
});
|
|
12147
|
-
}
|
|
12148
|
-
return {
|
|
12149
|
-
async listPublicEventCalendarWindow({ signal, ...params }) {
|
|
12150
|
-
return deps.resilientFetchData("listPublicEventCalendarWindow", `public-calendar-window:${JSON.stringify(params)}`, (requestSignal) => deps.apiClient({
|
|
12151
|
-
endpoint: "listPublicEventCalendarWindow",
|
|
12152
|
-
params: {
|
|
12153
|
-
...params,
|
|
12154
|
-
limit: params.limit === void 0 ? void 0 : String(params.limit)
|
|
12155
|
-
},
|
|
12156
|
-
options: { signal: requestSignal }
|
|
12157
|
-
}), {
|
|
12158
|
-
signal,
|
|
12159
|
-
cacheTags: buildPublicReadMemoryCacheTags("listPublicEventCalendarWindow", { siteId: params.siteId })
|
|
12160
|
-
});
|
|
12161
|
-
},
|
|
12162
|
-
async resolveEventOccurrence(params) {
|
|
12163
|
-
const response = await resolveEventSubroute(params, "event-occurrence");
|
|
12164
|
-
return { occurrence: response.subroute?.kind === "event-occurrence" ? response.subroute.occurrence : null };
|
|
12165
|
-
},
|
|
12166
|
-
async resolveEventRun(params) {
|
|
12167
|
-
const response = await resolveEventSubroute(params, "event-run");
|
|
12168
|
-
return { run: response.subroute?.kind === "event-run" ? response.subroute.run : null };
|
|
12169
|
-
}
|
|
12170
|
-
};
|
|
12009
|
+
} };
|
|
12171
12010
|
}
|
|
12172
12011
|
//#endregion
|
|
12173
12012
|
//#region src/client/combineAbortSignals.ts
|
|
@@ -12261,6 +12100,38 @@ function generateRequestId() {
|
|
|
12261
12100
|
function toRecord(value) {
|
|
12262
12101
|
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
12263
12102
|
}
|
|
12103
|
+
function adapterExceptionMessage(error) {
|
|
12104
|
+
return error instanceof Error ? error.message : String(error);
|
|
12105
|
+
}
|
|
12106
|
+
function publishedCacheLifetime(plan, payload) {
|
|
12107
|
+
if (plan.endpoint !== "getContentByPath" || pageReadDependencies(payload) !== "availability") return {
|
|
12108
|
+
freshTtlSec: plan.freshTtlSec,
|
|
12109
|
+
staleTtlSec: plan.staleTtlSec
|
|
12110
|
+
};
|
|
12111
|
+
const ttl = buildPageReadCachePolicy(plan.siteId ?? "", "availability").revalidate;
|
|
12112
|
+
return {
|
|
12113
|
+
freshTtlSec: ttl,
|
|
12114
|
+
staleTtlSec: ttl
|
|
12115
|
+
};
|
|
12116
|
+
}
|
|
12117
|
+
function reusableDurablePayload(plan, payload, freshness) {
|
|
12118
|
+
return plan.endpoint !== "getContentByPath" || pageReadDependencies(payload) !== "availability" || freshness === "fresh";
|
|
12119
|
+
}
|
|
12120
|
+
function memoryWritePolicy(pageRead, data, tags, cacheTTL) {
|
|
12121
|
+
if (!pageRead) return { tags };
|
|
12122
|
+
const dependency = pageReadDependencies(data);
|
|
12123
|
+
const policy = buildPageReadCachePolicy(pageRead.siteId, dependency);
|
|
12124
|
+
return {
|
|
12125
|
+
tags: policy.tags,
|
|
12126
|
+
...dependency === "availability" ? {
|
|
12127
|
+
ttl: Math.min(cacheTTL, policy.revalidate * 1e3),
|
|
12128
|
+
staleTtl: 0
|
|
12129
|
+
} : {}
|
|
12130
|
+
};
|
|
12131
|
+
}
|
|
12132
|
+
function isPageReadRefusal(pageRead, error) {
|
|
12133
|
+
return Boolean(pageRead) && error instanceof RiverbankApiError && error.status === 404;
|
|
12134
|
+
}
|
|
12264
12135
|
function getRuntimePayloadSiteId(value) {
|
|
12265
12136
|
const site = toRecord(value).site;
|
|
12266
12137
|
if (!site || typeof site !== "object" || Array.isArray(site)) return null;
|
|
@@ -12378,6 +12249,7 @@ function getNetworkErrorCode(error) {
|
|
|
12378
12249
|
* - AbortError (let propagate raw for consumer detection)
|
|
12379
12250
|
*/
|
|
12380
12251
|
function convertToTypedError(error) {
|
|
12252
|
+
rethrowClientFrameworkSignal(error);
|
|
12381
12253
|
if (isAbortError(error)) throw error;
|
|
12382
12254
|
if (error instanceof ApiEnvelopeError) throw new RiverbankApiError({
|
|
12383
12255
|
code: error.code,
|
|
@@ -12385,7 +12257,8 @@ function convertToTypedError(error) {
|
|
|
12385
12257
|
requestId: error.requestId,
|
|
12386
12258
|
timestamp: error.timestamp,
|
|
12387
12259
|
status: error.status,
|
|
12388
|
-
fieldErrors: error.fieldErrors
|
|
12260
|
+
fieldErrors: error.fieldErrors,
|
|
12261
|
+
tag: error.tag
|
|
12389
12262
|
});
|
|
12390
12263
|
if (error instanceof ApiRequestError && error.body && typeof error.body === "object") {
|
|
12391
12264
|
const body = error.body;
|
|
@@ -12434,6 +12307,15 @@ function resolveAuth(config) {
|
|
|
12434
12307
|
};
|
|
12435
12308
|
throw new Error("Authentication configuration is required. Provide either `auth` (recommended) or `apiKey` (deprecated). For public endpoints without auth, use: { auth: { type: \"none\" } }");
|
|
12436
12309
|
}
|
|
12310
|
+
/** The framework adapter is fixed at construction: `@riverbankcms/sdk/next` supplies Next's. */
|
|
12311
|
+
function createRuntimeApiClient(deps, config, authConfig) {
|
|
12312
|
+
const frameworkCache = config.frameworkCache;
|
|
12313
|
+
const requestOptions = frameworkCache ? {
|
|
12314
|
+
...sdkRequestOptions,
|
|
12315
|
+
frameworkCache
|
|
12316
|
+
} : sdkRequestOptions;
|
|
12317
|
+
return withDefaultHeaders(authConfig.type === "none" ? deps.createInternalAPIClient(config.baseUrl, requestOptions) : deps.createBearerAPIClient(authConfig.type === "api-key" ? authConfig.key : authConfig.token, config.baseUrl, requestOptions), config.defaultHeaders);
|
|
12318
|
+
}
|
|
12437
12319
|
const defaultRiverbankClientDeps = {
|
|
12438
12320
|
createBearerAPIClient: createRuntimeBearerAPIClient,
|
|
12439
12321
|
createInternalAPIClient: createRuntimeInternalAPIClient
|
|
@@ -12452,8 +12334,8 @@ const defaultRiverbankClientDeps = {
|
|
|
12452
12334
|
* ```
|
|
12453
12335
|
*/
|
|
12454
12336
|
/**
|
|
12455
|
-
*
|
|
12456
|
-
*
|
|
12337
|
+
* Next's tagged cache owns normal reads; SDK memory remains an outage fallback by default.
|
|
12338
|
+
* Explicitly enabled admitted-page memory hits also register their returned framework policy.
|
|
12457
12339
|
*/
|
|
12458
12340
|
function isRunningInNextServer() {
|
|
12459
12341
|
return typeof window === "undefined" && typeof process !== "undefined" && Boolean(process.env.NEXT_RUNTIME);
|
|
@@ -12465,6 +12347,13 @@ function resolveMemoryCachePolicy(config) {
|
|
|
12465
12347
|
servesFreshMemoryHits: enabled ?? !isRunningInNextServer()
|
|
12466
12348
|
};
|
|
12467
12349
|
}
|
|
12350
|
+
/** The server marks a page built with parts missing (`x-riverbank-page-storage: no-store`); no SDK cache may keep it. */
|
|
12351
|
+
function readLive(response) {
|
|
12352
|
+
return {
|
|
12353
|
+
data: unwrapResponse(response),
|
|
12354
|
+
storable: !(response.success && response.meta?.storage === "no-store")
|
|
12355
|
+
};
|
|
12356
|
+
}
|
|
12468
12357
|
function createRiverbankClient(config) {
|
|
12469
12358
|
return createRiverbankClientWithDeps(defaultRiverbankClientDeps, config);
|
|
12470
12359
|
}
|
|
@@ -12503,7 +12392,8 @@ function createRiverbankClientWithDeps(deps, config) {
|
|
|
12503
12392
|
keyType = "preview";
|
|
12504
12393
|
break;
|
|
12505
12394
|
}
|
|
12506
|
-
const
|
|
12395
|
+
const frameworkCache = config.frameworkCache;
|
|
12396
|
+
const apiClient = createRuntimeApiClient(deps, config, authConfig);
|
|
12507
12397
|
const cache = new SimpleCache({
|
|
12508
12398
|
maxSize: cacheMaxSize,
|
|
12509
12399
|
ttl: cacheTTL,
|
|
@@ -12554,7 +12444,7 @@ function createRiverbankClientWithDeps(deps, config) {
|
|
|
12554
12444
|
const result = await reader({
|
|
12555
12445
|
cacheKey: plan.cacheKey,
|
|
12556
12446
|
endpoint: plan.endpoint,
|
|
12557
|
-
payloadSchemaVersion:
|
|
12447
|
+
payloadSchemaVersion: 5
|
|
12558
12448
|
});
|
|
12559
12449
|
if (result.kind === "miss") return {
|
|
12560
12450
|
kind: "miss",
|
|
@@ -12570,6 +12460,7 @@ function createRiverbankClientWithDeps(deps, config) {
|
|
|
12570
12460
|
error: result.error
|
|
12571
12461
|
}
|
|
12572
12462
|
};
|
|
12463
|
+
if (!reusableDurablePayload(plan, result.payload, result.freshness)) return null;
|
|
12573
12464
|
return {
|
|
12574
12465
|
kind: "hit",
|
|
12575
12466
|
result: emitStatus(result.freshness === "fresh" ? "cache" : "stale", result.payload, statusDetails({
|
|
@@ -12585,7 +12476,7 @@ function createRiverbankClientWithDeps(deps, config) {
|
|
|
12585
12476
|
outcome: "error",
|
|
12586
12477
|
error: {
|
|
12587
12478
|
kind: "adapter_exception",
|
|
12588
|
-
message:
|
|
12479
|
+
message: adapterExceptionMessage(error)
|
|
12589
12480
|
}
|
|
12590
12481
|
}
|
|
12591
12482
|
};
|
|
@@ -12601,13 +12492,21 @@ function createRiverbankClientWithDeps(deps, config) {
|
|
|
12601
12492
|
normalizedParams: plan.normalizedParams,
|
|
12602
12493
|
payload,
|
|
12603
12494
|
siteId: plan.siteId ?? getRuntimePayloadSiteId(payload),
|
|
12604
|
-
|
|
12605
|
-
|
|
12606
|
-
payloadSchemaVersion: 4,
|
|
12495
|
+
...publishedCacheLifetime(plan, payload),
|
|
12496
|
+
payloadSchemaVersion: 5,
|
|
12607
12497
|
writeReason: "live_success"
|
|
12608
12498
|
});
|
|
12609
12499
|
} catch {}
|
|
12610
12500
|
}
|
|
12501
|
+
function tryPrebuildFallback(input) {
|
|
12502
|
+
const prebuild = input.allowed && !input.preview && input.fallback ? input.fallback() : null;
|
|
12503
|
+
return prebuild ? emitStatus("prebuild", prebuild.data, input.statusDetails({
|
|
12504
|
+
prebuildAgeSec: prebuild.prebuildAgeSec,
|
|
12505
|
+
cacheTier: "prebuild",
|
|
12506
|
+
durableCache: input.durableCache,
|
|
12507
|
+
error: input.error
|
|
12508
|
+
})) : null;
|
|
12509
|
+
}
|
|
12611
12510
|
async function resilientFetch(cacheKey, fetcher, options) {
|
|
12612
12511
|
const requestId = generateRequestId();
|
|
12613
12512
|
const startTime = Date.now();
|
|
@@ -12642,18 +12541,18 @@ function createRiverbankClientWithDeps(deps, config) {
|
|
|
12642
12541
|
}) : null;
|
|
12643
12542
|
const durableCache = durableFallback?.kind === "miss" || durableFallback?.kind === "error" ? durableFallback.diagnostic : void 0;
|
|
12644
12543
|
if (durableFallback?.kind === "hit") return durableFallback.result;
|
|
12645
|
-
|
|
12646
|
-
|
|
12647
|
-
|
|
12648
|
-
|
|
12649
|
-
|
|
12650
|
-
|
|
12651
|
-
|
|
12652
|
-
|
|
12653
|
-
|
|
12654
|
-
|
|
12655
|
-
|
|
12656
|
-
|
|
12544
|
+
const prebuild = tryPrebuildFallback({
|
|
12545
|
+
allowed: allowFallbacks,
|
|
12546
|
+
preview: isPreview,
|
|
12547
|
+
fallback: options.prebuildFallback,
|
|
12548
|
+
statusDetails,
|
|
12549
|
+
durableCache,
|
|
12550
|
+
error: {
|
|
12551
|
+
code: "circuit_open",
|
|
12552
|
+
message: "Circuit breaker is open"
|
|
12553
|
+
}
|
|
12554
|
+
});
|
|
12555
|
+
if (prebuild) return prebuild;
|
|
12657
12556
|
const circuitState = circuitBreaker.getState();
|
|
12658
12557
|
emitStatus("error", null, statusDetails({
|
|
12659
12558
|
durableCache,
|
|
@@ -12664,31 +12563,38 @@ function createRiverbankClientWithDeps(deps, config) {
|
|
|
12664
12563
|
}));
|
|
12665
12564
|
throw new CircuitOpenError(circuitState);
|
|
12666
12565
|
}
|
|
12667
|
-
|
|
12668
|
-
|
|
12669
|
-
if (
|
|
12670
|
-
|
|
12671
|
-
|
|
12672
|
-
|
|
12673
|
-
|
|
12674
|
-
return unwrapResponse(await fetcher(combinedSignal));
|
|
12675
|
-
} catch (error) {
|
|
12676
|
-
convertToTypedError(error);
|
|
12677
|
-
}
|
|
12678
|
-
}, {
|
|
12679
|
-
...retryConfig,
|
|
12680
|
-
requestTimeoutMs
|
|
12681
|
-
});
|
|
12682
|
-
circuitBreaker.recordSuccess();
|
|
12683
|
-
} else try {
|
|
12684
|
-
data = unwrapResponse(await fetcher(options.signal ?? new AbortController().signal));
|
|
12566
|
+
const storeLive = async (data) => {
|
|
12567
|
+
if (shouldWrite(cacheEnabled, options.force)) cache.set(cacheKey, data, memoryWritePolicy(options.pageRead, data, options.cacheTags, cacheTTL));
|
|
12568
|
+
if (allowFallbacks && !isPreview) await writePublishedRuntimeCache(options.publishedRuntimeCache, data);
|
|
12569
|
+
};
|
|
12570
|
+
const fetchLive = async () => {
|
|
12571
|
+
if (!resilienceEnabled) try {
|
|
12572
|
+
return readLive(await fetcher(options.signal ?? new AbortController().signal));
|
|
12685
12573
|
} catch (error) {
|
|
12686
12574
|
convertToTypedError(error);
|
|
12687
12575
|
}
|
|
12688
|
-
if (
|
|
12689
|
-
|
|
12576
|
+
if (circuitBreaker.getState().state === "half-open") circuitBreaker.incrementHalfOpenRequests();
|
|
12577
|
+
const live = await fetchWithTimeoutAndRetry(async (timeoutSignal) => {
|
|
12578
|
+
const combinedSignal = options.signal ? combineAbortSignals(timeoutSignal, options.signal) : timeoutSignal;
|
|
12579
|
+
try {
|
|
12580
|
+
return readLive(await fetcher(combinedSignal));
|
|
12581
|
+
} catch (error) {
|
|
12582
|
+
convertToTypedError(error);
|
|
12583
|
+
}
|
|
12584
|
+
}, {
|
|
12585
|
+
...retryConfig,
|
|
12586
|
+
requestTimeoutMs
|
|
12587
|
+
});
|
|
12588
|
+
circuitBreaker.recordSuccess();
|
|
12589
|
+
return live;
|
|
12590
|
+
};
|
|
12591
|
+
try {
|
|
12592
|
+
const { data, storable } = await fetchLive();
|
|
12593
|
+
if (storable) await storeLive(data);
|
|
12690
12594
|
return emitStatus("live", data, statusDetails());
|
|
12691
12595
|
} catch (error) {
|
|
12596
|
+
rethrowClientFrameworkSignal(error);
|
|
12597
|
+
if (isPageReadRefusal(options.pageRead, error)) throw attachResilienceStatusToError(error, emitStatus("error", null, statusDetails({ error: getRiverbankErrorInfo(error) })).resilience);
|
|
12692
12598
|
if (resilienceEnabled && error instanceof Error) circuitBreaker.recordFailure(error);
|
|
12693
12599
|
if (allowFallbacks && !isPreview && staleIfError && cacheEnabled) {
|
|
12694
12600
|
const stale = cache.getStale(cacheKey);
|
|
@@ -12705,15 +12611,15 @@ function createRiverbankClientWithDeps(deps, config) {
|
|
|
12705
12611
|
const durableFallback = allowFallbacks && !isPreview ? await tryPublishedRuntimeCacheFallback(options.publishedRuntimeCache, statusDetails, errorInfo) : null;
|
|
12706
12612
|
const durableCache = durableFallback?.kind === "miss" || durableFallback?.kind === "error" ? durableFallback.diagnostic : void 0;
|
|
12707
12613
|
if (durableFallback?.kind === "hit") return durableFallback.result;
|
|
12708
|
-
|
|
12709
|
-
|
|
12710
|
-
|
|
12711
|
-
|
|
12712
|
-
|
|
12713
|
-
|
|
12714
|
-
|
|
12715
|
-
|
|
12716
|
-
|
|
12614
|
+
const prebuild = tryPrebuildFallback({
|
|
12615
|
+
allowed: allowFallbacks,
|
|
12616
|
+
preview: isPreview,
|
|
12617
|
+
fallback: options.prebuildFallback,
|
|
12618
|
+
statusDetails,
|
|
12619
|
+
durableCache,
|
|
12620
|
+
error: errorInfo
|
|
12621
|
+
});
|
|
12622
|
+
if (prebuild) return prebuild;
|
|
12717
12623
|
throw attachResilienceStatusToError(error, emitStatus("error", null, statusDetails({
|
|
12718
12624
|
error: errorInfo,
|
|
12719
12625
|
durableCache
|
|
@@ -12726,7 +12632,8 @@ function createRiverbankClientWithDeps(deps, config) {
|
|
|
12726
12632
|
const contentReads = createContentReadOperations({
|
|
12727
12633
|
apiClient,
|
|
12728
12634
|
resilientFetch,
|
|
12729
|
-
prebuildLoader
|
|
12635
|
+
prebuildLoader,
|
|
12636
|
+
frameworkCache
|
|
12730
12637
|
});
|
|
12731
12638
|
const eventReads = createPublicEventReadOperations({
|
|
12732
12639
|
apiClient,
|
|
@@ -13115,8 +13022,11 @@ function createRiverbankClientWithDeps(deps, config) {
|
|
|
13115
13022
|
},
|
|
13116
13023
|
getBaseUrl() {
|
|
13117
13024
|
return config.baseUrl;
|
|
13025
|
+
},
|
|
13026
|
+
hasFrameworkCache() {
|
|
13027
|
+
return frameworkCache !== void 0;
|
|
13118
13028
|
}
|
|
13119
13029
|
};
|
|
13120
13030
|
}
|
|
13121
13031
|
//#endregion
|
|
13122
|
-
export {
|
|
13032
|
+
export { DEFAULT_PUBLISHED_RUNTIME_CACHE_PAYLOAD_SCHEMA_VERSION as a, parsePublishedRuntimeCacheKey as c, API_ENDPOINTS as d, buildEndpointURL as f, createBearerAPIClient as h, resolveRuntimeCachePolicy as i, parsePublishedRuntimeCacheKeyDetails as l, CircuitOpenError as m, classifyPublishedRuntimeCacheFreshness as n, isPublishedRuntimeCacheKeyEndpoint as o, sdkRequestOptions as p, derivePublishedRuntimeCacheKey as r, normalizeRuntimePublicPath as s, createRiverbankClient as t, parsePublishedRuntimeCachePayloadSchemaVersion as u };
|