@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
@@ -1832,6 +1832,24 @@ var ENDPOINT_DEFINITIONS = {
1832
1832
  auth: "user",
1833
1833
  responseKind: "json"
1834
1834
  },
1835
+ resendSiteInvitation: {
1836
+ path: "/sites/{siteId}/members/invitations/{invitationId}/resend",
1837
+ method: "POST",
1838
+ errors: [
1839
+ "auth:forbidden",
1840
+ "resource:not_found",
1841
+ "validation:invalid_input",
1842
+ "external:service_error",
1843
+ "server:internal_error"
1844
+ ],
1845
+ tags: [
1846
+ "site-{siteId}",
1847
+ "site-members-{siteId}",
1848
+ "site-invite-{invitationId}"
1849
+ ],
1850
+ auth: "user",
1851
+ responseKind: "json"
1852
+ },
1835
1853
  transferSiteOwnership: {
1836
1854
  path: "/sites/{siteId}/members/transfer-ownership",
1837
1855
  method: "POST",
@@ -7009,7 +7027,7 @@ var SimpleCache = class {
7009
7027
  };
7010
7028
 
7011
7029
  // src/version.ts
7012
- var SDK_VERSION = "0.88.0";
7030
+ var SDK_VERSION = "0.89.1";
7013
7031
 
7014
7032
  // src/client/error.ts
7015
7033
  var RiverbankApiError = class _RiverbankApiError extends Error {
@@ -7172,80 +7190,654 @@ function getResilienceStatusFromError(error) {
7172
7190
  return error[resilienceStatusSymbol];
7173
7191
  }
7174
7192
 
7175
- // src/client/resilience.ts
7176
- var DEFAULT_RETRY_CONFIG = {
7177
- maxAttempts: 3,
7178
- baseDelayMs: 200,
7179
- maxDelayMs: 2e3,
7180
- jitter: "full"
7181
- };
7182
- var DEFAULT_CIRCUIT_BREAKER_CONFIG = {
7183
- failureThreshold: 5,
7184
- resetTimeoutMs: 3e4,
7185
- halfOpenMaxRequests: 2
7186
- };
7187
- var PERMANENT_NETWORK_ERROR_CODES = /* @__PURE__ */ new Set([
7188
- "ECONNREFUSED",
7189
- // Server is not running / port not listening
7190
- "ENOTFOUND",
7191
- // DNS lookup failed - hostname doesn't exist
7192
- "EAI_AGAIN"
7193
- // DNS lookup timeout (usually permanent for invalid hosts)
7194
- ]);
7195
- var TRANSIENT_NETWORK_ERROR_CODES = /* @__PURE__ */ new Set([
7196
- "ECONNRESET",
7197
- // Connection was reset mid-request (server dropped it)
7198
- "EPIPE",
7199
- // Broken pipe (connection closed while writing)
7200
- "ETIMEDOUT",
7201
- // Connection timed out (could be temporary congestion)
7202
- "ESOCKETTIMEDOUT"
7203
- // Socket timeout
7204
- ]);
7205
- var NODE_NETWORK_ERROR_CODES = /* @__PURE__ */ new Set([
7206
- // Permanent
7207
- "ECONNREFUSED",
7208
- "ENOTFOUND",
7209
- "EAI_AGAIN",
7210
- // Transient
7211
- "ECONNRESET",
7212
- "EPIPE",
7213
- "ETIMEDOUT",
7214
- "ESOCKETTIMEDOUT"
7215
- ]);
7216
- function isNodeNetworkErrorCode(code) {
7217
- return !code.includes(":") && NODE_NETWORK_ERROR_CODES.has(code);
7218
- }
7219
- function getErrorCodeFromCause(error) {
7220
- let current = error;
7221
- while (current) {
7222
- const nodeError = current;
7223
- if (nodeError.code && typeof nodeError.code === "string") {
7224
- if (isNodeNetworkErrorCode(nodeError.code)) {
7225
- return nodeError.code;
7226
- }
7227
- }
7228
- const errorWithCause = current;
7229
- current = errorWithCause.cause;
7193
+ // src/public-api/runtime.ts
7194
+ var PUBLIC_ENDPOINT_NAMES2 = [
7195
+ "getSite",
7196
+ "getContentByPath",
7197
+ "listPublishedEntries",
7198
+ "getPublishedEntryPreview",
7199
+ "getPublicFormById",
7200
+ "listPublicForms",
7201
+ "getPublicBookingServices",
7202
+ "getPublicChallenge",
7203
+ "listPublicEvents",
7204
+ "batchBlockLoaders",
7205
+ "listPublicCourses",
7206
+ "listPublicTeamMembers",
7207
+ "listPublicProducts",
7208
+ "listPublicPasses",
7209
+ "listPublicMemberships",
7210
+ "resolveEntrySubroute",
7211
+ "resolveEventOccurrence",
7212
+ "checkRedirect",
7213
+ "getRoutableContent",
7214
+ "getPublicRoutableContent",
7215
+ "getPublicSitemapRoutes"
7216
+ ];
7217
+ var API_ENDPOINTS2 = Object.freeze({
7218
+ getSite: {
7219
+ path: "/sites",
7220
+ method: "GET",
7221
+ revalidate: 900,
7222
+ tags: ["riverbank:site", "riverbank:site:id:{id}", "riverbank:site:slug:{slug}", "riverbank:site:domain:{domain}"],
7223
+ auth: "public",
7224
+ responseKind: "json"
7225
+ },
7226
+ getContentByPath: {
7227
+ path: "/sites/{siteId}/pages",
7228
+ method: "GET",
7229
+ tags: ["riverbank:site:{siteId}:routable-content"],
7230
+ auth: "public",
7231
+ responseKind: "json"
7232
+ },
7233
+ listPublishedEntries: {
7234
+ path: "/public/content/{siteId}/{type}/entries",
7235
+ method: "GET",
7236
+ revalidate: 60,
7237
+ tags: ["content-{siteId}-{type}"],
7238
+ auth: "public",
7239
+ responseKind: "json"
7240
+ },
7241
+ getPublishedEntryPreview: {
7242
+ path: "/public/content/{siteId}/{type}/{slug}/preview",
7243
+ method: "GET",
7244
+ revalidate: 60,
7245
+ tags: ["content-{siteId}-{type}-{slug}"],
7246
+ auth: "public",
7247
+ responseKind: "json"
7248
+ },
7249
+ getPublicFormById: {
7250
+ path: "/public/forms/{formId}",
7251
+ method: "GET",
7252
+ revalidate: 60,
7253
+ tags: ["riverbank:form:{formId}"],
7254
+ auth: "public",
7255
+ responseKind: "json"
7256
+ },
7257
+ listPublicForms: {
7258
+ path: "/public/sites/{siteId}/forms",
7259
+ method: "GET",
7260
+ revalidate: 60,
7261
+ tags: ["riverbank:site:{siteId}:forms"],
7262
+ auth: "public",
7263
+ responseKind: "json"
7264
+ },
7265
+ getPublicBookingServices: {
7266
+ path: "/public/bookings/services",
7267
+ method: "GET",
7268
+ revalidate: 60,
7269
+ tags: ["site-{siteId}"],
7270
+ auth: "public",
7271
+ responseKind: "json"
7272
+ },
7273
+ getPublicChallenge: {
7274
+ path: "/public/challenge",
7275
+ method: "GET",
7276
+ auth: "public",
7277
+ responseKind: "text"
7278
+ },
7279
+ listPublicEvents: {
7280
+ path: "/public/sites/{siteId}/events",
7281
+ method: "GET",
7282
+ revalidate: 60,
7283
+ tags: ["riverbank:site:{siteId}:public-events"],
7284
+ auth: "public",
7285
+ responseKind: "json"
7286
+ },
7287
+ batchBlockLoaders: {
7288
+ path: "/public/sites/{siteId}/block-loaders/batch",
7289
+ method: "POST",
7290
+ auth: "public",
7291
+ responseKind: "json"
7292
+ },
7293
+ listPublicCourses: {
7294
+ path: "/public/sites/{siteId}/courses",
7295
+ method: "GET",
7296
+ revalidate: 60,
7297
+ tags: ["riverbank:site:{siteId}:public-courses"],
7298
+ auth: "public",
7299
+ responseKind: "json"
7300
+ },
7301
+ listPublicTeamMembers: {
7302
+ path: "/public/sites/{siteId}/team-members",
7303
+ method: "GET",
7304
+ revalidate: 60,
7305
+ tags: ["riverbank:site:{siteId}:public-team-members"],
7306
+ auth: "public",
7307
+ responseKind: "json"
7308
+ },
7309
+ listPublicProducts: {
7310
+ path: "/public/sites/{siteId}/products",
7311
+ method: "GET",
7312
+ revalidate: 300,
7313
+ tags: ["riverbank:site:{siteId}:public-products"],
7314
+ auth: "public",
7315
+ responseKind: "json"
7316
+ },
7317
+ listPublicPasses: {
7318
+ path: "/public/sites/{siteId}/bookings/products/passes",
7319
+ method: "GET",
7320
+ revalidate: 300,
7321
+ tags: ["riverbank:site:{siteId}:public-passes"],
7322
+ auth: "public",
7323
+ responseKind: "json"
7324
+ },
7325
+ listPublicMemberships: {
7326
+ path: "/public/sites/{siteId}/bookings/products/memberships",
7327
+ method: "GET",
7328
+ revalidate: 300,
7329
+ tags: ["riverbank:site:{siteId}:public-memberships"],
7330
+ auth: "public",
7331
+ responseKind: "json"
7332
+ },
7333
+ resolveEntrySubroute: {
7334
+ path: "/public/sites/{siteId}/routing/subroutes/resolve",
7335
+ method: "GET",
7336
+ revalidate: 60,
7337
+ tags: ["site-{siteId}", "entry-subroute"],
7338
+ auth: "public",
7339
+ responseKind: "json"
7340
+ },
7341
+ resolveEventOccurrence: {
7342
+ path: "/public/sites/{siteId}/events/occurrences/resolve",
7343
+ method: "GET",
7344
+ revalidate: 60,
7345
+ tags: ["riverbank:site:{siteId}:public-events", "event-occurrence"],
7346
+ auth: "public",
7347
+ responseKind: "json"
7348
+ },
7349
+ checkRedirect: {
7350
+ path: "/public/content/redirect",
7351
+ method: "GET",
7352
+ revalidate: 86400,
7353
+ tags: ["redirect"],
7354
+ auth: "public",
7355
+ responseKind: "json"
7356
+ },
7357
+ getRoutableContent: {
7358
+ path: "/sites/{siteId}/routable-content",
7359
+ method: "GET",
7360
+ revalidate: 60,
7361
+ tags: ["riverbank:site:{siteId}:routable-content"],
7362
+ auth: "user",
7363
+ responseKind: "json"
7364
+ },
7365
+ getPublicRoutableContent: {
7366
+ path: "/public/sites/{siteId}/routable-content",
7367
+ method: "GET",
7368
+ revalidate: 60,
7369
+ tags: ["riverbank:site:{siteId}:routable-content"],
7370
+ auth: "public",
7371
+ responseKind: "json"
7372
+ },
7373
+ getPublicSitemapRoutes: {
7374
+ path: "/public/sites/{siteId}/sitemap",
7375
+ method: "GET",
7376
+ revalidate: 60,
7377
+ tags: ["riverbank:site:{siteId}:routable-content", "riverbank:site:{siteId}:settings"],
7378
+ auth: "public",
7379
+ responseKind: "json"
7230
7380
  }
7231
- return void 0;
7381
+ });
7382
+ function buildEndpointURL2(baseURL, endpoint) {
7383
+ return baseURL + API_ENDPOINTS2[endpoint].path;
7232
7384
  }
7233
- function isTransientError(error) {
7234
- if (error instanceof RiverbankApiError) {
7235
- const errorCode = getErrorCodeFromCause(error);
7236
- if (errorCode && PERMANENT_NETWORK_ERROR_CODES.has(errorCode)) {
7237
- return false;
7238
- }
7239
- if (error.status === 0) return true;
7240
- if (error.status === 429) return true;
7241
- if (error.status >= 500) return true;
7242
- return false;
7243
- }
7244
- if (error instanceof TypeError) {
7245
- const errorCode = getErrorCodeFromCause(error);
7246
- if (errorCode) {
7247
- if (PERMANENT_NETWORK_ERROR_CODES.has(errorCode)) {
7248
- return false;
7385
+
7386
+ // src/client/runtimeCachePolicy.ts
7387
+ var DEFAULT_PUBLISHED_RUNTIME_CACHE_PAYLOAD_SCHEMA_VERSION = 1;
7388
+ var DEFAULT_STALE_TTL_SEC = 24 * 60 * 60;
7389
+ var DEFAULT_MEMORY_TTL_SEC = 60;
7390
+ var RUNTIME_CACHE_DURABILITY_OVERRIDES = {
7391
+ getSite: {
7392
+ kind: "durable-public-stale",
7393
+ staleTtlSec: DEFAULT_STALE_TTL_SEC
7394
+ },
7395
+ getContentByPath: {
7396
+ kind: "durable-public-stale",
7397
+ staleTtlSec: DEFAULT_STALE_TTL_SEC
7398
+ },
7399
+ listPublishedEntries: {
7400
+ kind: "memory-only",
7401
+ reason: "durable_rollout_pending"
7402
+ },
7403
+ getPublishedEntryPreview: {
7404
+ kind: "memory-only",
7405
+ reason: "durable_rollout_pending"
7406
+ },
7407
+ getPublicFormById: {
7408
+ kind: "memory-only",
7409
+ reason: "durable_rollout_pending"
7410
+ },
7411
+ listPublicForms: {
7412
+ kind: "memory-only",
7413
+ reason: "durable_rollout_pending"
7414
+ },
7415
+ getPublicBookingServices: {
7416
+ kind: "live-only",
7417
+ reason: "safety_sensitive_booking"
7418
+ },
7419
+ getPublicChallenge: {
7420
+ kind: "live-only",
7421
+ reason: "challenge_endpoint"
7422
+ },
7423
+ listPublicEvents: {
7424
+ kind: "memory-only",
7425
+ reason: "durable_rollout_pending"
7426
+ },
7427
+ batchBlockLoaders: {
7428
+ kind: "live-only",
7429
+ reason: "opaque_batch_loader"
7430
+ },
7431
+ listPublicCourses: {
7432
+ kind: "memory-only",
7433
+ reason: "durable_rollout_pending"
7434
+ },
7435
+ listPublicTeamMembers: {
7436
+ kind: "memory-only",
7437
+ reason: "durable_rollout_pending"
7438
+ },
7439
+ listPublicProducts: {
7440
+ kind: "memory-only",
7441
+ reason: "durable_rollout_pending"
7442
+ },
7443
+ listPublicPasses: {
7444
+ kind: "live-only",
7445
+ reason: "safety_sensitive_booking"
7446
+ },
7447
+ listPublicMemberships: {
7448
+ kind: "live-only",
7449
+ reason: "safety_sensitive_booking"
7450
+ },
7451
+ resolveEntrySubroute: {
7452
+ kind: "memory-only",
7453
+ reason: "durable_rollout_pending"
7454
+ },
7455
+ resolveEventOccurrence: {
7456
+ kind: "memory-only",
7457
+ reason: "durable_rollout_pending"
7458
+ },
7459
+ checkRedirect: {
7460
+ kind: "memory-only",
7461
+ reason: "durable_rollout_pending"
7462
+ },
7463
+ getRoutableContent: {
7464
+ kind: "live-only",
7465
+ reason: "auth_required"
7466
+ },
7467
+ getPublicRoutableContent: {
7468
+ kind: "memory-only",
7469
+ reason: "durable_rollout_pending"
7470
+ },
7471
+ getPublicSitemapRoutes: {
7472
+ kind: "memory-only",
7473
+ reason: "durable_rollout_pending"
7474
+ }
7475
+ };
7476
+ var PUBLIC_ENDPOINT_NAME_SET = new Set(PUBLIC_ENDPOINT_NAMES2);
7477
+ function isPublicEndpointName(endpoint) {
7478
+ return PUBLIC_ENDPOINT_NAME_SET.has(endpoint);
7479
+ }
7480
+ function isTruthyParam(value) {
7481
+ return value === true || value === "true" || value === 1 || value === "1";
7482
+ }
7483
+ function isPreviewRequest(endpoint, params) {
7484
+ if (endpoint === "getContentByPath") {
7485
+ return isTruthyParam(params.preview);
7486
+ }
7487
+ if (endpoint === "listPublishedEntries" || endpoint === "resolveEntrySubroute" || endpoint === "resolveEventOccurrence") {
7488
+ return params.stage === "preview";
7489
+ }
7490
+ return false;
7491
+ }
7492
+ function getEndpointFreshTtlSec(endpoint) {
7493
+ return API_ENDPOINTS2[endpoint].revalidate ?? DEFAULT_MEMORY_TTL_SEC;
7494
+ }
7495
+ function assertNever(value) {
7496
+ throw new Error(`Unhandled runtime cache policy override: ${String(value)}`);
7497
+ }
7498
+ function resolveKnownEndpointPolicy(endpoint, params) {
7499
+ if (isPreviewRequest(endpoint, params)) {
7500
+ return { kind: "live-only", endpoint, reason: "preview_request" };
7501
+ }
7502
+ if (endpoint === "getSite" && isTruthyParam(params.force)) {
7503
+ return { kind: "live-only", endpoint, reason: "force_refresh" };
7504
+ }
7505
+ const override = RUNTIME_CACHE_DURABILITY_OVERRIDES[endpoint];
7506
+ if (override.kind === "live-only") {
7507
+ return { kind: "live-only", endpoint, reason: override.reason };
7508
+ }
7509
+ const endpointDefinition = API_ENDPOINTS2[endpoint];
7510
+ if (endpointDefinition.method !== "GET") {
7511
+ return { kind: "live-only", endpoint, reason: "non_get_request" };
7512
+ }
7513
+ if (endpointDefinition.auth === "user") {
7514
+ return { kind: "live-only", endpoint, reason: "auth_required" };
7515
+ }
7516
+ switch (override.kind) {
7517
+ case "durable-public-stale":
7518
+ return {
7519
+ kind: "durable-public-stale",
7520
+ endpoint,
7521
+ freshTtlSec: getEndpointFreshTtlSec(endpoint),
7522
+ staleTtlSec: override.staleTtlSec
7523
+ };
7524
+ case "memory-only":
7525
+ return {
7526
+ kind: "memory-only",
7527
+ endpoint,
7528
+ freshTtlSec: getEndpointFreshTtlSec(endpoint),
7529
+ reason: override.reason
7530
+ };
7531
+ default:
7532
+ return assertNever(override);
7533
+ }
7534
+ }
7535
+ function resolveRuntimeCachePolicy(input) {
7536
+ if (input.method && input.method.toUpperCase() !== "GET") {
7537
+ return {
7538
+ kind: "live-only",
7539
+ endpoint: input.endpoint,
7540
+ reason: "non_get_request"
7541
+ };
7542
+ }
7543
+ if (!isPublicEndpointName(input.endpoint)) {
7544
+ return {
7545
+ kind: "live-only",
7546
+ endpoint: input.endpoint,
7547
+ reason: "unknown_endpoint"
7548
+ };
7549
+ }
7550
+ return resolveKnownEndpointPolicy(input.endpoint, input.params ?? {});
7551
+ }
7552
+ function toNonEmptyString(value) {
7553
+ if (value === null || value === void 0) return null;
7554
+ if (typeof value !== "string" && typeof value !== "number" && typeof value !== "boolean") {
7555
+ return null;
7556
+ }
7557
+ const normalized = String(value).trim();
7558
+ return normalized.length > 0 ? normalized : null;
7559
+ }
7560
+ function normalizeRuntimePublicPath(value) {
7561
+ const raw = toNonEmptyString(value) ?? "/";
7562
+ const withoutQuery = raw.split(/[?#]/, 1)[0] ?? "/";
7563
+ const withLeadingSlash = withoutQuery.startsWith("/") ? withoutQuery : `/${withoutQuery}`;
7564
+ const collapsed = withLeadingSlash.replace(/\/{2,}/g, "/");
7565
+ const withoutTrailingSlash = collapsed.length > 1 ? collapsed.replace(/\/+$/g, "") : collapsed;
7566
+ return withoutTrailingSlash || "/";
7567
+ }
7568
+ function normalizeRuntimeHostname(value) {
7569
+ const trimmed = value.trim().toLowerCase();
7570
+ const url = /^[a-z][a-z0-9+.-]*:\/\//.test(trimmed) ? new URL(trimmed) : new URL(`http://${trimmed}`);
7571
+ return url.hostname.replace(/\.$/, "");
7572
+ }
7573
+ function normalizeScalar(value) {
7574
+ return value.trim().toLowerCase();
7575
+ }
7576
+ function encodeKeyPart(key, value) {
7577
+ return `${encodeURIComponent(key)}=${encodeURIComponent(value)}`;
7578
+ }
7579
+ function unsafeAsPublishedRuntimeCacheKey(value) {
7580
+ return value;
7581
+ }
7582
+ function buildPublishedRuntimeCacheKey(endpoint, normalizedParams) {
7583
+ const encodedParams = Object.entries(normalizedParams).sort(([left], [right]) => left.localeCompare(right)).map(([key, value]) => encodeKeyPart(key, value)).join(":");
7584
+ return unsafeAsPublishedRuntimeCacheKey(
7585
+ `published-runtime:v1:${endpoint}:${encodedParams}`
7586
+ );
7587
+ }
7588
+ function selectSiteRuntimeIdentity(params) {
7589
+ const slug = toNonEmptyString(params.slug);
7590
+ if (slug !== null) return { slug: normalizeScalar(slug) };
7591
+ const domain = toNonEmptyString(params.domain);
7592
+ if (domain !== null) return { domain: normalizeRuntimeHostname(domain) };
7593
+ const id = toNonEmptyString(params.id);
7594
+ if (id !== null) return { id: normalizeScalar(id) };
7595
+ return null;
7596
+ }
7597
+ function deriveGetSiteKey(params) {
7598
+ const identity = selectSiteRuntimeIdentity(params);
7599
+ if (identity === null) {
7600
+ return {
7601
+ ok: false,
7602
+ error: {
7603
+ kind: "missing_site_identity",
7604
+ acceptedParams: ["slug", "domain", "id"]
7605
+ }
7606
+ };
7607
+ }
7608
+ const normalizedParams = {
7609
+ ...identity,
7610
+ currentPath: normalizeRuntimePublicPath(params.currentPath)
7611
+ };
7612
+ return {
7613
+ ok: true,
7614
+ endpoint: "getSite",
7615
+ key: buildPublishedRuntimeCacheKey("getSite", normalizedParams),
7616
+ normalizedParams
7617
+ };
7618
+ }
7619
+ function deriveGetContentByPathKey(params) {
7620
+ const siteId = toNonEmptyString(params.siteId);
7621
+ if (siteId === null) {
7622
+ return {
7623
+ ok: false,
7624
+ error: {
7625
+ kind: "missing_required_param",
7626
+ endpoint: "getContentByPath",
7627
+ param: "siteId"
7628
+ }
7629
+ };
7630
+ }
7631
+ const normalizedParams = {
7632
+ siteId: normalizeScalar(siteId),
7633
+ path: normalizeRuntimePublicPath(params.path)
7634
+ };
7635
+ return {
7636
+ ok: true,
7637
+ endpoint: "getContentByPath",
7638
+ key: buildPublishedRuntimeCacheKey("getContentByPath", normalizedParams),
7639
+ normalizedParams
7640
+ };
7641
+ }
7642
+ var DURABLE_RUNTIME_CACHE_KEY_DERIVERS = {
7643
+ getSite: deriveGetSiteKey,
7644
+ getContentByPath: deriveGetContentByPathKey
7645
+ };
7646
+ function isPublishedRuntimeCacheKeyEndpoint(value) {
7647
+ return typeof value === "string" && Object.prototype.hasOwnProperty.call(DURABLE_RUNTIME_CACHE_KEY_DERIVERS, value);
7648
+ }
7649
+ function parsePublishedRuntimeCacheKey(value) {
7650
+ const details = parsePublishedRuntimeCacheKeyDetails(value);
7651
+ if (!details.ok) {
7652
+ return details;
7653
+ }
7654
+ return {
7655
+ ok: true,
7656
+ key: details.key,
7657
+ endpoint: details.endpoint
7658
+ };
7659
+ }
7660
+ function parsePublishedRuntimeCacheKeyDetails(value) {
7661
+ if (typeof value !== "string") {
7662
+ return { ok: false, error: "not_string" };
7663
+ }
7664
+ const parts = value.split(":");
7665
+ if (parts[0] !== "published-runtime" || parts[1] !== "v1") {
7666
+ return { ok: false, error: "invalid_prefix" };
7667
+ }
7668
+ const endpoint = parts[2];
7669
+ if (!isPublishedRuntimeCacheKeyEndpoint(endpoint)) {
7670
+ return { ok: false, error: "unknown_endpoint" };
7671
+ }
7672
+ const normalizedParams = {};
7673
+ for (const part of parts.slice(3)) {
7674
+ const separatorIndex = part.indexOf("=");
7675
+ if (separatorIndex <= 0) {
7676
+ return { ok: false, error: "invalid_param_encoding" };
7677
+ }
7678
+ try {
7679
+ const key = decodeURIComponent(part.slice(0, separatorIndex));
7680
+ const paramValue = decodeURIComponent(part.slice(separatorIndex + 1));
7681
+ normalizedParams[key] = paramValue;
7682
+ } catch {
7683
+ return { ok: false, error: "invalid_param_encoding" };
7684
+ }
7685
+ }
7686
+ if (!hasExpectedPublishedRuntimeCacheKeyParams(endpoint, normalizedParams)) {
7687
+ return { ok: false, error: "invalid_param_encoding" };
7688
+ }
7689
+ return {
7690
+ ok: true,
7691
+ key: unsafeAsPublishedRuntimeCacheKey(value),
7692
+ endpoint,
7693
+ normalizedParams
7694
+ };
7695
+ }
7696
+ function hasExpectedPublishedRuntimeCacheKeyParams(endpoint, normalizedParams) {
7697
+ const keys = Object.keys(normalizedParams).sort();
7698
+ switch (endpoint) {
7699
+ case "getSite": {
7700
+ const identityKeys = ["domain", "id", "slug"].filter(
7701
+ (key) => normalizedParams[key] !== void 0
7702
+ );
7703
+ return identityKeys.length === 1 && normalizedParams.currentPath !== void 0 && keys.every(
7704
+ (key) => ["currentPath", "domain", "id", "slug"].includes(key)
7705
+ );
7706
+ }
7707
+ case "getContentByPath":
7708
+ return normalizedParams.path !== void 0 && normalizedParams.siteId !== void 0 && keys.every((key) => ["path", "siteId"].includes(key));
7709
+ }
7710
+ }
7711
+ function parsePublishedRuntimeCachePayloadSchemaVersion(value) {
7712
+ if (typeof value !== "number") {
7713
+ return { ok: false, error: "not_number" };
7714
+ }
7715
+ if (!Number.isInteger(value)) {
7716
+ return { ok: false, error: "not_integer" };
7717
+ }
7718
+ if (value <= 0) {
7719
+ return { ok: false, error: "not_positive" };
7720
+ }
7721
+ return {
7722
+ ok: true,
7723
+ value
7724
+ };
7725
+ }
7726
+ function classifyPublishedRuntimeCacheFreshness(input) {
7727
+ const freshUntilMs = Date.parse(input.freshUntil);
7728
+ const staleUntilMs = Date.parse(input.staleUntil);
7729
+ if (Number.isNaN(freshUntilMs)) {
7730
+ return { kind: "invalid_timestamp", field: "freshUntil" };
7731
+ }
7732
+ if (Number.isNaN(staleUntilMs)) {
7733
+ return { kind: "invalid_timestamp", field: "staleUntil" };
7734
+ }
7735
+ const nowMs = input.now.getTime();
7736
+ if (nowMs > staleUntilMs) {
7737
+ return { kind: "expired" };
7738
+ }
7739
+ if (nowMs <= freshUntilMs) {
7740
+ return { kind: "fresh", staleAgeSec: 0 };
7741
+ }
7742
+ return {
7743
+ kind: "stale",
7744
+ staleAgeSec: Math.floor((nowMs - freshUntilMs) / 1e3)
7745
+ };
7746
+ }
7747
+ function derivePublishedRuntimeCacheKey(input) {
7748
+ const policy = resolveRuntimeCachePolicy({
7749
+ endpoint: input.endpoint,
7750
+ method: "GET",
7751
+ params: input.params
7752
+ });
7753
+ if (policy.kind !== "durable-public-stale") {
7754
+ return {
7755
+ ok: false,
7756
+ error: { kind: "not_durable_eligible", policy }
7757
+ };
7758
+ }
7759
+ switch (input.endpoint) {
7760
+ case "getSite":
7761
+ return DURABLE_RUNTIME_CACHE_KEY_DERIVERS.getSite(input.params);
7762
+ case "getContentByPath":
7763
+ return DURABLE_RUNTIME_CACHE_KEY_DERIVERS.getContentByPath(input.params);
7764
+ }
7765
+ }
7766
+
7767
+ // src/client/resilience.ts
7768
+ var DEFAULT_RETRY_CONFIG = {
7769
+ maxAttempts: 3,
7770
+ baseDelayMs: 200,
7771
+ maxDelayMs: 2e3,
7772
+ jitter: "full"
7773
+ };
7774
+ var DEFAULT_CIRCUIT_BREAKER_CONFIG = {
7775
+ failureThreshold: 5,
7776
+ resetTimeoutMs: 3e4,
7777
+ halfOpenMaxRequests: 2
7778
+ };
7779
+ var PERMANENT_NETWORK_ERROR_CODES = /* @__PURE__ */ new Set([
7780
+ "ECONNREFUSED",
7781
+ // Server is not running / port not listening
7782
+ "ENOTFOUND",
7783
+ // DNS lookup failed - hostname doesn't exist
7784
+ "EAI_AGAIN"
7785
+ // DNS lookup timeout (usually permanent for invalid hosts)
7786
+ ]);
7787
+ var TRANSIENT_NETWORK_ERROR_CODES = /* @__PURE__ */ new Set([
7788
+ "ECONNRESET",
7789
+ // Connection was reset mid-request (server dropped it)
7790
+ "EPIPE",
7791
+ // Broken pipe (connection closed while writing)
7792
+ "ETIMEDOUT",
7793
+ // Connection timed out (could be temporary congestion)
7794
+ "ESOCKETTIMEDOUT"
7795
+ // Socket timeout
7796
+ ]);
7797
+ var NODE_NETWORK_ERROR_CODES = /* @__PURE__ */ new Set([
7798
+ // Permanent
7799
+ "ECONNREFUSED",
7800
+ "ENOTFOUND",
7801
+ "EAI_AGAIN",
7802
+ // Transient
7803
+ "ECONNRESET",
7804
+ "EPIPE",
7805
+ "ETIMEDOUT",
7806
+ "ESOCKETTIMEDOUT"
7807
+ ]);
7808
+ function isNodeNetworkErrorCode(code) {
7809
+ return !code.includes(":") && NODE_NETWORK_ERROR_CODES.has(code);
7810
+ }
7811
+ function getErrorCodeFromCause(error) {
7812
+ let current = error;
7813
+ while (current) {
7814
+ const nodeError = current;
7815
+ if (nodeError.code && typeof nodeError.code === "string") {
7816
+ if (isNodeNetworkErrorCode(nodeError.code)) {
7817
+ return nodeError.code;
7818
+ }
7819
+ }
7820
+ const errorWithCause = current;
7821
+ current = errorWithCause.cause;
7822
+ }
7823
+ return void 0;
7824
+ }
7825
+ function isTransientError(error) {
7826
+ if (error instanceof RiverbankApiError) {
7827
+ const errorCode = getErrorCodeFromCause(error);
7828
+ if (errorCode && PERMANENT_NETWORK_ERROR_CODES.has(errorCode)) {
7829
+ return false;
7830
+ }
7831
+ if (error.status === 0) return true;
7832
+ if (error.status === 429) return true;
7833
+ if (error.status >= 500) return true;
7834
+ return false;
7835
+ }
7836
+ if (error instanceof TypeError) {
7837
+ const errorCode = getErrorCodeFromCause(error);
7838
+ if (errorCode) {
7839
+ if (PERMANENT_NETWORK_ERROR_CODES.has(errorCode)) {
7840
+ return false;
7249
7841
  }
7250
7842
  if (TRANSIENT_NETWORK_ERROR_CODES.has(errorCode)) {
7251
7843
  return true;
@@ -7481,12 +8073,57 @@ setSdkVersion(SDK_VERSION);
7481
8073
  var DEFAULT_BROWSER_TIMEOUT_MS = 5e3;
7482
8074
  var DEFAULT_SERVER_TIMEOUT_MS = 8e3;
7483
8075
  var MAX_GET_ENTRIES_BY_IDENTIFIERS_REFS = 50;
8076
+ function isDurableRuntimeCacheTier(cacheTier) {
8077
+ return cacheTier === "durable-fresh" || cacheTier === "durable-stale";
8078
+ }
8079
+ function isDegradedResilienceStatus(source, details) {
8080
+ return source === "stale" || source === "error" || isDurableRuntimeCacheTier(details.cacheTier) && details.error !== void 0;
8081
+ }
7484
8082
  function generateRequestId2() {
7485
8083
  return `req-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
7486
8084
  }
7487
8085
  function toRecord(value) {
7488
8086
  return value && typeof value === "object" && !Array.isArray(value) ? value : {};
7489
8087
  }
8088
+ function getRuntimePayloadSiteId(value) {
8089
+ const site = toRecord(value).site;
8090
+ if (!site || typeof site !== "object" || Array.isArray(site)) {
8091
+ return null;
8092
+ }
8093
+ const id = site.id;
8094
+ return typeof id === "string" && id.trim().length > 0 ? id : null;
8095
+ }
8096
+ function getRiverbankErrorInfo(error) {
8097
+ if (error instanceof RiverbankApiError) {
8098
+ return { code: error.code, message: error.message, status: error.status };
8099
+ }
8100
+ if (error instanceof Error) {
8101
+ return { message: error.message };
8102
+ }
8103
+ return { message: String(error) };
8104
+ }
8105
+ function planPublishedRuntimeCache(input) {
8106
+ const policy = resolveRuntimeCachePolicy({
8107
+ endpoint: input.endpoint,
8108
+ method: "GET",
8109
+ params: input.params
8110
+ });
8111
+ if (policy.kind !== "durable-public-stale") {
8112
+ return null;
8113
+ }
8114
+ const keyResult = derivePublishedRuntimeCacheKey(input);
8115
+ if (!keyResult.ok) {
8116
+ return null;
8117
+ }
8118
+ return {
8119
+ cacheKey: keyResult.key,
8120
+ endpoint: keyResult.endpoint,
8121
+ normalizedParams: keyResult.normalizedParams,
8122
+ freshTtlSec: policy.freshTtlSec,
8123
+ staleTtlSec: policy.staleTtlSec,
8124
+ siteId: input.siteId ?? null
8125
+ };
8126
+ }
7490
8127
  function normalizeEntryIdentifierRefs(identifiers) {
7491
8128
  const trimmed = identifiers.map((identifier) => identifier.trim()).filter((identifier) => identifier.length > 0);
7492
8129
  if (trimmed.length === 0) {
@@ -7720,6 +8357,8 @@ function createRiverbankClient(config) {
7720
8357
  source,
7721
8358
  isPreview: details.isPreview,
7722
8359
  cacheKey: details.cacheKey,
8360
+ cacheTier: details.cacheTier,
8361
+ durableCache: details.durableCache,
7723
8362
  error: details.error,
7724
8363
  staleAgeSec: details.staleAgeSec,
7725
8364
  prebuildAgeSec: details.prebuildAgeSec,
@@ -7729,7 +8368,7 @@ function createRiverbankClient(config) {
7729
8368
  };
7730
8369
  lastStatus = status;
7731
8370
  config.resilience?.onStatusChange?.(status);
7732
- const nowDegraded = source === "stale" || source === "error";
8371
+ const nowDegraded = isDegradedResilienceStatus(source, details);
7733
8372
  if (nowDegraded !== isDegraded) {
7734
8373
  isDegraded = nowDegraded;
7735
8374
  config.resilience?.onDegradedMode?.(nowDegraded, status);
@@ -7739,6 +8378,80 @@ function createRiverbankClient(config) {
7739
8378
  resilience: status
7740
8379
  };
7741
8380
  }
8381
+ async function tryPublishedRuntimeCacheFallback(plan, statusDetails, errorInfo) {
8382
+ const reader = config.publishedRuntimeCache?.read;
8383
+ if (!plan || !reader) {
8384
+ return null;
8385
+ }
8386
+ try {
8387
+ const result = await reader({
8388
+ cacheKey: plan.cacheKey,
8389
+ endpoint: plan.endpoint,
8390
+ payloadSchemaVersion: DEFAULT_PUBLISHED_RUNTIME_CACHE_PAYLOAD_SCHEMA_VERSION
8391
+ });
8392
+ if (result.kind === "miss") {
8393
+ return {
8394
+ kind: "miss",
8395
+ diagnostic: {
8396
+ outcome: "miss",
8397
+ reason: result.reason
8398
+ }
8399
+ };
8400
+ }
8401
+ if (result.kind === "error") {
8402
+ return {
8403
+ kind: "error",
8404
+ diagnostic: {
8405
+ outcome: "error",
8406
+ error: result.error
8407
+ }
8408
+ };
8409
+ }
8410
+ return {
8411
+ kind: "hit",
8412
+ result: emitStatus(
8413
+ result.freshness === "fresh" ? "cache" : "stale",
8414
+ result.payload,
8415
+ statusDetails({
8416
+ error: errorInfo,
8417
+ staleAgeSec: result.staleAgeSec,
8418
+ cacheTier: result.freshness === "fresh" ? "durable-fresh" : "durable-stale"
8419
+ })
8420
+ )
8421
+ };
8422
+ } catch (error) {
8423
+ return {
8424
+ kind: "error",
8425
+ diagnostic: {
8426
+ outcome: "error",
8427
+ error: {
8428
+ kind: "adapter_exception",
8429
+ message: error instanceof Error ? error.message : String(error)
8430
+ }
8431
+ }
8432
+ };
8433
+ }
8434
+ }
8435
+ async function writePublishedRuntimeCache(plan, payload) {
8436
+ const writer = config.publishedRuntimeCache?.write;
8437
+ if (!plan || !writer) {
8438
+ return;
8439
+ }
8440
+ try {
8441
+ await writer({
8442
+ cacheKey: plan.cacheKey,
8443
+ endpoint: plan.endpoint,
8444
+ normalizedParams: plan.normalizedParams,
8445
+ payload,
8446
+ siteId: plan.siteId ?? getRuntimePayloadSiteId(payload),
8447
+ freshTtlSec: plan.freshTtlSec,
8448
+ staleTtlSec: plan.staleTtlSec,
8449
+ payloadSchemaVersion: DEFAULT_PUBLISHED_RUNTIME_CACHE_PAYLOAD_SCHEMA_VERSION,
8450
+ writeReason: "live_success"
8451
+ });
8452
+ } catch {
8453
+ }
8454
+ }
7742
8455
  async function resilientFetch(cacheKey, fetcher, options) {
7743
8456
  const requestId = generateRequestId2();
7744
8457
  const startTime = Date.now();
@@ -7754,7 +8467,11 @@ function createRiverbankClient(config) {
7754
8467
  if (cacheEnabled && !options.force) {
7755
8468
  const fresh = cache.getFresh(cacheKey);
7756
8469
  if (fresh !== null) {
7757
- return emitStatus("cache", fresh, statusDetails());
8470
+ return emitStatus(
8471
+ "cache",
8472
+ fresh,
8473
+ statusDetails({ cacheTier: "memory-fresh" })
8474
+ );
7758
8475
  }
7759
8476
  }
7760
8477
  if (resilienceEnabled && circuitBreaker.isOpen()) {
@@ -7766,6 +8483,7 @@ function createRiverbankClient(config) {
7766
8483
  stale.value,
7767
8484
  statusDetails({
7768
8485
  staleAgeSec: stale.staleAgeSec,
8486
+ cacheTier: "memory-stale",
7769
8487
  error: {
7770
8488
  code: "circuit_open",
7771
8489
  message: "Circuit breaker is open"
@@ -7774,6 +8492,15 @@ function createRiverbankClient(config) {
7774
8492
  );
7775
8493
  }
7776
8494
  }
8495
+ const durableFallback = allowFallbacks && !isPreview ? await tryPublishedRuntimeCacheFallback(
8496
+ options.publishedRuntimeCache,
8497
+ statusDetails,
8498
+ { code: "circuit_open", message: "Circuit breaker is open" }
8499
+ ) : null;
8500
+ const durableCache = durableFallback?.kind === "miss" || durableFallback?.kind === "error" ? durableFallback.diagnostic : void 0;
8501
+ if (durableFallback?.kind === "hit") {
8502
+ return durableFallback.result;
8503
+ }
7777
8504
  if (allowFallbacks && !isPreview && options.prebuildFallback) {
7778
8505
  const prebuildResult = options.prebuildFallback();
7779
8506
  if (prebuildResult) {
@@ -7782,6 +8509,8 @@ function createRiverbankClient(config) {
7782
8509
  prebuildResult.data,
7783
8510
  statusDetails({
7784
8511
  prebuildAgeSec: prebuildResult.prebuildAgeSec,
8512
+ cacheTier: "prebuild",
8513
+ durableCache,
7785
8514
  error: {
7786
8515
  code: "circuit_open",
7787
8516
  message: "Circuit breaker is open"
@@ -7795,6 +8524,7 @@ function createRiverbankClient(config) {
7795
8524
  "error",
7796
8525
  null,
7797
8526
  statusDetails({
8527
+ durableCache,
7798
8528
  error: { code: "circuit_open", message: "Circuit breaker is open" }
7799
8529
  })
7800
8530
  );
@@ -7835,6 +8565,9 @@ function createRiverbankClient(config) {
7835
8565
  if (cacheEnabled) {
7836
8566
  cache.set(cacheKey, data);
7837
8567
  }
8568
+ if (allowFallbacks && !isPreview) {
8569
+ await writePublishedRuntimeCache(options.publishedRuntimeCache, data);
8570
+ }
7838
8571
  return emitStatus("live", data, statusDetails());
7839
8572
  } catch (error) {
7840
8573
  if (resilienceEnabled && error instanceof Error) {
@@ -7843,44 +8576,47 @@ function createRiverbankClient(config) {
7843
8576
  if (allowFallbacks && !isPreview && staleIfError && cacheEnabled) {
7844
8577
  const stale = cache.getStale(cacheKey);
7845
8578
  if (stale) {
7846
- const errorInfo2 = error instanceof RiverbankApiError ? {
7847
- code: error.code,
7848
- message: error.message,
7849
- status: error.status
7850
- } : { message: error.message };
8579
+ const errorInfo2 = getRiverbankErrorInfo(error);
7851
8580
  return emitStatus(
7852
8581
  "stale",
7853
8582
  stale.value,
7854
8583
  statusDetails({
7855
8584
  staleAgeSec: stale.staleAgeSec,
8585
+ cacheTier: "memory-stale",
7856
8586
  error: errorInfo2
7857
8587
  })
7858
8588
  );
7859
8589
  }
7860
8590
  }
8591
+ const errorInfo = getRiverbankErrorInfo(error);
8592
+ const durableFallback = allowFallbacks && !isPreview ? await tryPublishedRuntimeCacheFallback(
8593
+ options.publishedRuntimeCache,
8594
+ statusDetails,
8595
+ errorInfo
8596
+ ) : null;
8597
+ const durableCache = durableFallback?.kind === "miss" || durableFallback?.kind === "error" ? durableFallback.diagnostic : void 0;
8598
+ if (durableFallback?.kind === "hit") {
8599
+ return durableFallback.result;
8600
+ }
7861
8601
  if (allowFallbacks && !isPreview && options.prebuildFallback) {
7862
8602
  const prebuildResult = options.prebuildFallback();
7863
8603
  if (prebuildResult) {
7864
- const errorInfo2 = error instanceof RiverbankApiError ? {
7865
- code: error.code,
7866
- message: error.message,
7867
- status: error.status
7868
- } : { message: error.message };
7869
8604
  return emitStatus(
7870
8605
  "prebuild",
7871
8606
  prebuildResult.data,
7872
8607
  statusDetails({
7873
8608
  prebuildAgeSec: prebuildResult.prebuildAgeSec,
7874
- error: errorInfo2
8609
+ cacheTier: "prebuild",
8610
+ durableCache,
8611
+ error: errorInfo
7875
8612
  })
7876
8613
  );
7877
8614
  }
7878
8615
  }
7879
- const errorInfo = error instanceof RiverbankApiError ? { code: error.code, message: error.message, status: error.status } : { message: error.message };
7880
8616
  const failure = emitStatus(
7881
8617
  "error",
7882
8618
  null,
7883
- statusDetails({ error: errorInfo })
8619
+ statusDetails({ error: errorInfo, durableCache })
7884
8620
  );
7885
8621
  throw attachResilienceStatusToError(error, failure.resilience);
7886
8622
  }
@@ -7930,8 +8666,12 @@ function createRiverbankClient(config) {
7930
8666
  );
7931
8667
  }
7932
8668
  const siteIdentifier = slug || domain || id;
7933
- const cacheKey = `site:${siteIdentifier ?? "unknown"}:${currentPath ?? ""}`;
7934
8669
  const siteId = id || slug || domain;
8670
+ const publishedRuntimeCache = planPublishedRuntimeCache({
8671
+ endpoint: "getSite",
8672
+ params: { slug, domain, id, currentPath, force }
8673
+ });
8674
+ const cacheKey = publishedRuntimeCache?.cacheKey ?? `site:${siteIdentifier ?? "unknown"}:${currentPath ?? ""}`;
7935
8675
  return resilientFetch(
7936
8676
  cacheKey,
7937
8677
  async (sig) => {
@@ -7954,13 +8694,19 @@ function createRiverbankClient(config) {
7954
8694
  {
7955
8695
  signal,
7956
8696
  force,
8697
+ publishedRuntimeCache,
7957
8698
  prebuildFallback: prebuildLoader && siteId ? () => prebuildLoader.loadSite(siteId) : void 0
7958
8699
  }
7959
8700
  );
7960
8701
  }
7961
8702
  async function getPageWithResilienceInternal(params) {
7962
8703
  const { siteId, path: path3, preview = false, signal } = params;
7963
- const cacheKey = `page:${siteId}:${path3}:${preview}`;
8704
+ const publishedRuntimeCache = planPublishedRuntimeCache({
8705
+ endpoint: "getContentByPath",
8706
+ params: { siteId, path: path3, preview },
8707
+ siteId
8708
+ });
8709
+ const cacheKey = publishedRuntimeCache?.cacheKey ?? `page:${siteId}:${path3}:${preview}`;
7964
8710
  return resilientFetch(
7965
8711
  cacheKey,
7966
8712
  async (sig) => {
@@ -7973,6 +8719,7 @@ function createRiverbankClient(config) {
7973
8719
  {
7974
8720
  preview,
7975
8721
  signal,
8722
+ publishedRuntimeCache,
7976
8723
  // Prebuild fallback only for published pages (not preview)
7977
8724
  prebuildFallback: prebuildLoader && !preview ? () => prebuildLoader.loadPage(siteId, path3) : void 0
7978
8725
  }
@@ -9106,176 +9853,6 @@ function createPrebuildLoader(config) {
9106
9853
  return new PrebuildLoader(config);
9107
9854
  }
9108
9855
 
9109
- // src/public-api/runtime.ts
9110
- var API_ENDPOINTS2 = Object.freeze({
9111
- getSite: {
9112
- path: "/sites",
9113
- method: "GET",
9114
- revalidate: 900,
9115
- tags: ["riverbank:site", "riverbank:site:id:{id}", "riverbank:site:slug:{slug}", "riverbank:site:domain:{domain}"],
9116
- auth: "public",
9117
- responseKind: "json"
9118
- },
9119
- getContentByPath: {
9120
- path: "/sites/{siteId}/pages",
9121
- method: "GET",
9122
- tags: ["riverbank:site:{siteId}:routable-content"],
9123
- auth: "public",
9124
- responseKind: "json"
9125
- },
9126
- listPublishedEntries: {
9127
- path: "/public/content/{siteId}/{type}/entries",
9128
- method: "GET",
9129
- revalidate: 60,
9130
- tags: ["content-{siteId}-{type}"],
9131
- auth: "public",
9132
- responseKind: "json"
9133
- },
9134
- getPublishedEntryPreview: {
9135
- path: "/public/content/{siteId}/{type}/{slug}/preview",
9136
- method: "GET",
9137
- revalidate: 60,
9138
- tags: ["content-{siteId}-{type}-{slug}"],
9139
- auth: "public",
9140
- responseKind: "json"
9141
- },
9142
- getPublicFormById: {
9143
- path: "/public/forms/{formId}",
9144
- method: "GET",
9145
- revalidate: 60,
9146
- tags: ["riverbank:form:{formId}"],
9147
- auth: "public",
9148
- responseKind: "json"
9149
- },
9150
- listPublicForms: {
9151
- path: "/public/sites/{siteId}/forms",
9152
- method: "GET",
9153
- revalidate: 60,
9154
- tags: ["riverbank:site:{siteId}:forms"],
9155
- auth: "public",
9156
- responseKind: "json"
9157
- },
9158
- getPublicBookingServices: {
9159
- path: "/public/bookings/services",
9160
- method: "GET",
9161
- revalidate: 60,
9162
- tags: ["site-{siteId}"],
9163
- auth: "public",
9164
- responseKind: "json"
9165
- },
9166
- getPublicChallenge: {
9167
- path: "/public/challenge",
9168
- method: "GET",
9169
- auth: "public",
9170
- responseKind: "text"
9171
- },
9172
- listPublicEvents: {
9173
- path: "/public/sites/{siteId}/events",
9174
- method: "GET",
9175
- revalidate: 60,
9176
- tags: ["riverbank:site:{siteId}:public-events"],
9177
- auth: "public",
9178
- responseKind: "json"
9179
- },
9180
- batchBlockLoaders: {
9181
- path: "/public/sites/{siteId}/block-loaders/batch",
9182
- method: "POST",
9183
- auth: "public",
9184
- responseKind: "json"
9185
- },
9186
- listPublicCourses: {
9187
- path: "/public/sites/{siteId}/courses",
9188
- method: "GET",
9189
- revalidate: 60,
9190
- tags: ["riverbank:site:{siteId}:public-courses"],
9191
- auth: "public",
9192
- responseKind: "json"
9193
- },
9194
- listPublicTeamMembers: {
9195
- path: "/public/sites/{siteId}/team-members",
9196
- method: "GET",
9197
- revalidate: 60,
9198
- tags: ["riverbank:site:{siteId}:public-team-members"],
9199
- auth: "public",
9200
- responseKind: "json"
9201
- },
9202
- listPublicProducts: {
9203
- path: "/public/sites/{siteId}/products",
9204
- method: "GET",
9205
- revalidate: 300,
9206
- tags: ["riverbank:site:{siteId}:public-products"],
9207
- auth: "public",
9208
- responseKind: "json"
9209
- },
9210
- listPublicPasses: {
9211
- path: "/public/sites/{siteId}/bookings/products/passes",
9212
- method: "GET",
9213
- revalidate: 300,
9214
- tags: ["riverbank:site:{siteId}:public-passes"],
9215
- auth: "public",
9216
- responseKind: "json"
9217
- },
9218
- listPublicMemberships: {
9219
- path: "/public/sites/{siteId}/bookings/products/memberships",
9220
- method: "GET",
9221
- revalidate: 300,
9222
- tags: ["riverbank:site:{siteId}:public-memberships"],
9223
- auth: "public",
9224
- responseKind: "json"
9225
- },
9226
- resolveEntrySubroute: {
9227
- path: "/public/sites/{siteId}/routing/subroutes/resolve",
9228
- method: "GET",
9229
- revalidate: 60,
9230
- tags: ["site-{siteId}", "entry-subroute"],
9231
- auth: "public",
9232
- responseKind: "json"
9233
- },
9234
- resolveEventOccurrence: {
9235
- path: "/public/sites/{siteId}/events/occurrences/resolve",
9236
- method: "GET",
9237
- revalidate: 60,
9238
- tags: ["riverbank:site:{siteId}:public-events", "event-occurrence"],
9239
- auth: "public",
9240
- responseKind: "json"
9241
- },
9242
- checkRedirect: {
9243
- path: "/public/content/redirect",
9244
- method: "GET",
9245
- revalidate: 86400,
9246
- tags: ["redirect"],
9247
- auth: "public",
9248
- responseKind: "json"
9249
- },
9250
- getRoutableContent: {
9251
- path: "/sites/{siteId}/routable-content",
9252
- method: "GET",
9253
- revalidate: 60,
9254
- tags: ["riverbank:site:{siteId}:routable-content"],
9255
- auth: "user",
9256
- responseKind: "json"
9257
- },
9258
- getPublicRoutableContent: {
9259
- path: "/public/sites/{siteId}/routable-content",
9260
- method: "GET",
9261
- revalidate: 60,
9262
- tags: ["riverbank:site:{siteId}:routable-content"],
9263
- auth: "public",
9264
- responseKind: "json"
9265
- },
9266
- getPublicSitemapRoutes: {
9267
- path: "/public/sites/{siteId}/sitemap",
9268
- method: "GET",
9269
- revalidate: 60,
9270
- tags: ["riverbank:site:{siteId}:routable-content", "riverbank:site:{siteId}:settings"],
9271
- auth: "public",
9272
- responseKind: "json"
9273
- }
9274
- });
9275
- function buildEndpointURL2(baseURL, endpoint) {
9276
- return baseURL + API_ENDPOINTS2[endpoint].path;
9277
- }
9278
-
9279
9856
  // src/types/block-kinds.ts
9280
9857
  var SYSTEM_BLOCK_KINDS = [
9281
9858
  // Layout blocks
@@ -9329,14 +9906,23 @@ var SYSTEM_BLOCK_KINDS = [
9329
9906
  ];
9330
9907
  export {
9331
9908
  API_ENDPOINTS2 as API_ENDPOINTS,
9909
+ DEFAULT_PUBLISHED_RUNTIME_CACHE_PAYLOAD_SCHEMA_VERSION,
9332
9910
  PrebuildLoader,
9333
9911
  RiverbankApiError,
9334
9912
  SDK_CORRELATION_HEADER_NAMES,
9335
9913
  SYSTEM_BLOCK_KINDS,
9336
9914
  buildEndpointURL2 as buildEndpointURL,
9337
9915
  canUsePrebuild,
9916
+ classifyPublishedRuntimeCacheFreshness,
9338
9917
  createPrebuildLoader,
9339
9918
  createRiverbankClient,
9919
+ derivePublishedRuntimeCacheKey,
9340
9920
  getResilienceStatusFromError,
9341
- prebuildCache
9921
+ isPublishedRuntimeCacheKeyEndpoint,
9922
+ normalizeRuntimePublicPath,
9923
+ parsePublishedRuntimeCacheKey,
9924
+ parsePublishedRuntimeCacheKeyDetails,
9925
+ parsePublishedRuntimeCachePayloadSchemaVersion,
9926
+ prebuildCache,
9927
+ resolveRuntimeCachePolicy
9342
9928
  };