@riverbankcms/sdk 0.2.0 → 0.2.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 (176) hide show
  1. package/dist/cli/index.js +4840 -9
  2. package/dist/cli/index.js.map +1 -1
  3. package/dist/client/bookings.d.mts +82 -2
  4. package/dist/client/bookings.d.ts +82 -2
  5. package/dist/client/bookings.js +1623 -3
  6. package/dist/client/bookings.js.map +1 -1
  7. package/dist/client/bookings.mjs +1610 -5
  8. package/dist/client/bookings.mjs.map +1 -1
  9. package/dist/client/client.d.mts +8 -5
  10. package/dist/client/client.d.ts +8 -5
  11. package/dist/client/client.js +16856 -322
  12. package/dist/client/client.js.map +1 -1
  13. package/dist/client/client.mjs +16838 -307
  14. package/dist/client/client.mjs.map +1 -1
  15. package/dist/client/hooks.d.mts +10 -7
  16. package/dist/client/hooks.d.ts +10 -7
  17. package/dist/client/hooks.js +5074 -4
  18. package/dist/client/hooks.js.map +1 -1
  19. package/dist/client/hooks.mjs +5074 -4
  20. package/dist/client/hooks.mjs.map +1 -1
  21. package/dist/client/rendering/client.d.mts +7 -1
  22. package/dist/client/rendering/client.d.ts +7 -1
  23. package/dist/client/rendering/client.js +17388 -2
  24. package/dist/client/rendering/client.js.map +1 -1
  25. package/dist/client/rendering/client.mjs +17382 -2
  26. package/dist/client/rendering/client.mjs.map +1 -1
  27. package/dist/client/resolver-BhueZVxZ.d.mts +61 -0
  28. package/dist/client/resolver-BhueZVxZ.d.ts +61 -0
  29. package/dist/client/usePage-BBcFCxOU.d.ts +6297 -0
  30. package/dist/client/usePage-BydHcMYB.d.mts +6297 -0
  31. package/dist/server/Layout-CLg8oH_S.d.ts +44 -0
  32. package/dist/server/Layout-DK_9OOgb.d.mts +44 -0
  33. package/dist/server/chunk-3J46ILMJ.mjs +2111 -0
  34. package/dist/server/chunk-3J46ILMJ.mjs.map +1 -0
  35. package/dist/server/{chunk-JB4LIEFS.js → chunk-5R4NMVXA.js} +15 -8
  36. package/dist/server/chunk-5R4NMVXA.js.map +1 -0
  37. package/dist/server/{chunk-ADREPXFU.js → chunk-62ZJI564.js} +3 -3
  38. package/dist/server/{chunk-ADREPXFU.js.map → chunk-62ZJI564.js.map} +1 -1
  39. package/dist/server/chunk-7DS4Q3GA.mjs +333 -0
  40. package/dist/server/chunk-7DS4Q3GA.mjs.map +1 -0
  41. package/dist/server/chunk-BJTO5JO5.mjs +11 -0
  42. package/dist/server/{chunk-4Z5FBFRL.mjs → chunk-BPKYRPCQ.mjs} +7 -3
  43. package/dist/server/{chunk-4Z5FBFRL.mjs.map → chunk-BPKYRPCQ.mjs.map} +1 -1
  44. package/dist/server/chunk-DGUM43GV.js +11 -0
  45. package/dist/server/chunk-DGUM43GV.js.map +1 -0
  46. package/dist/server/chunk-EGTDJ4PL.js +5461 -0
  47. package/dist/server/chunk-EGTDJ4PL.js.map +1 -0
  48. package/dist/server/chunk-FK64TZBT.mjs +831 -0
  49. package/dist/server/chunk-FK64TZBT.mjs.map +1 -0
  50. package/dist/server/chunk-GKYNDDJS.js +2111 -0
  51. package/dist/server/chunk-GKYNDDJS.js.map +1 -0
  52. package/dist/server/chunk-HOY77YBF.js +333 -0
  53. package/dist/server/chunk-HOY77YBF.js.map +1 -0
  54. package/dist/server/chunk-INWKF3IC.js +831 -0
  55. package/dist/server/chunk-INWKF3IC.js.map +1 -0
  56. package/dist/server/{chunk-2RW5HAQQ.mjs → chunk-JTAERCX2.mjs} +2 -2
  57. package/dist/server/chunk-O5DC7MYW.mjs +9606 -0
  58. package/dist/server/chunk-O5DC7MYW.mjs.map +1 -0
  59. package/dist/server/{chunk-PEAXKTDU.mjs → chunk-OP2GHK27.mjs} +2 -2
  60. package/dist/server/{chunk-WKG57P2H.mjs → chunk-PN3CHDVX.mjs} +10 -3
  61. package/dist/server/{chunk-WKG57P2H.mjs.map → chunk-PN3CHDVX.mjs.map} +1 -1
  62. package/dist/server/chunk-SF63XAX7.js +9606 -0
  63. package/dist/server/chunk-SF63XAX7.js.map +1 -0
  64. package/dist/server/{chunk-F472SMKX.js → chunk-TO7FD6TQ.js} +4 -4
  65. package/dist/server/{chunk-F472SMKX.js.map → chunk-TO7FD6TQ.js.map} +1 -1
  66. package/dist/server/chunk-USQF2XTU.mjs +5461 -0
  67. package/dist/server/chunk-USQF2XTU.mjs.map +1 -0
  68. package/dist/server/{chunk-SW7LE4M3.js → chunk-XLVL5WPH.js} +12 -8
  69. package/dist/server/chunk-XLVL5WPH.js.map +1 -0
  70. package/dist/server/components-BzdA6NAc.d.mts +305 -0
  71. package/dist/server/components-DhIcstww.d.ts +305 -0
  72. package/dist/server/components.d.mts +13 -49
  73. package/dist/server/components.d.ts +13 -49
  74. package/dist/server/components.js +7 -4
  75. package/dist/server/components.js.map +1 -1
  76. package/dist/server/components.mjs +9 -6
  77. package/dist/server/components.mjs.map +1 -1
  78. package/dist/server/config-validation.d.mts +2 -2
  79. package/dist/server/config-validation.d.ts +2 -2
  80. package/dist/server/config-validation.js +6 -3
  81. package/dist/server/config-validation.js.map +1 -1
  82. package/dist/server/config-validation.mjs +5 -2
  83. package/dist/server/config.d.mts +3 -3
  84. package/dist/server/config.d.ts +3 -3
  85. package/dist/server/config.js +6 -3
  86. package/dist/server/config.js.map +1 -1
  87. package/dist/server/config.mjs +5 -2
  88. package/dist/server/config.mjs.map +1 -1
  89. package/dist/server/data.d.mts +9 -8
  90. package/dist/server/data.d.ts +9 -8
  91. package/dist/server/data.js +4 -2
  92. package/dist/server/data.js.map +1 -1
  93. package/dist/server/data.mjs +3 -1
  94. package/dist/server/{index-C6M0Wfjq.d.ts → index-BB28KAui.d.ts} +1 -1
  95. package/dist/server/{index-B0yI_V6Z.d.mts → index-C_FVup_o.d.mts} +1 -1
  96. package/dist/server/index.d.mts +1554 -5
  97. package/dist/server/index.d.ts +1554 -5
  98. package/dist/server/index.js +4 -4
  99. package/dist/server/index.js.map +1 -1
  100. package/dist/server/index.mjs +4 -4
  101. package/dist/server/index.mjs.map +1 -1
  102. package/dist/server/{loadContent-CJcbYF3J.d.ts → loadContent-AQOBf_gP.d.ts} +4 -4
  103. package/dist/server/{loadContent-zhlL4YSE.d.mts → loadContent-DBmprsB4.d.mts} +4 -4
  104. package/dist/server/loadPage-3ECPF426.js +11 -0
  105. package/dist/server/loadPage-3ECPF426.js.map +1 -0
  106. package/dist/server/{loadPage-CCf15nt8.d.mts → loadPage-BMg8PJxJ.d.ts} +146 -5
  107. package/dist/server/loadPage-LW273NYO.mjs +11 -0
  108. package/dist/server/loadPage-LW273NYO.mjs.map +1 -0
  109. package/dist/server/{loadPage-BYmVMk0V.d.ts → loadPage-pg4HimlK.d.mts} +146 -5
  110. package/dist/server/metadata.d.mts +9 -6
  111. package/dist/server/metadata.d.ts +9 -6
  112. package/dist/server/metadata.js +3 -1
  113. package/dist/server/metadata.js.map +1 -1
  114. package/dist/server/metadata.mjs +2 -0
  115. package/dist/server/metadata.mjs.map +1 -1
  116. package/dist/server/rendering/server.d.mts +9 -7
  117. package/dist/server/rendering/server.d.ts +9 -7
  118. package/dist/server/rendering/server.js +7 -4
  119. package/dist/server/rendering/server.js.map +1 -1
  120. package/dist/server/rendering/server.mjs +6 -3
  121. package/dist/server/rendering.d.mts +172 -9
  122. package/dist/server/rendering.d.ts +172 -9
  123. package/dist/server/rendering.js +12 -9
  124. package/dist/server/rendering.js.map +1 -1
  125. package/dist/server/rendering.mjs +14 -11
  126. package/dist/server/rendering.mjs.map +1 -1
  127. package/dist/server/routing.d.mts +9 -6
  128. package/dist/server/routing.d.ts +9 -6
  129. package/dist/server/routing.js +4 -2
  130. package/dist/server/routing.js.map +1 -1
  131. package/dist/server/routing.mjs +3 -1
  132. package/dist/server/routing.mjs.map +1 -1
  133. package/dist/server/schema-Bpy9N5ZI.d.mts +1870 -0
  134. package/dist/server/schema-Bpy9N5ZI.d.ts +1870 -0
  135. package/dist/server/server.d.mts +11 -8
  136. package/dist/server/server.d.ts +11 -8
  137. package/dist/server/server.js +7 -5
  138. package/dist/server/server.js.map +1 -1
  139. package/dist/server/server.mjs +6 -4
  140. package/dist/server/theme-bridge.js +13 -10
  141. package/dist/server/theme-bridge.js.map +1 -1
  142. package/dist/server/theme-bridge.mjs +10 -7
  143. package/dist/server/theme-bridge.mjs.map +1 -1
  144. package/dist/server/theme.js +3 -1
  145. package/dist/server/theme.js.map +1 -1
  146. package/dist/server/theme.mjs +2 -0
  147. package/dist/server/theme.mjs.map +1 -1
  148. package/dist/server/{types-BCeqWtI2.d.ts → types--u4GLCAY.d.ts} +1 -1
  149. package/dist/server/types-BprgZt-t.d.ts +4149 -0
  150. package/dist/server/types-C0G9IxWO.d.mts +4149 -0
  151. package/dist/server/{types-Bbo01M7P.d.mts → types-_nDnPHpv.d.mts} +27 -1
  152. package/dist/server/{types-Bbo01M7P.d.ts → types-_nDnPHpv.d.ts} +27 -1
  153. package/dist/server/{types-BCeqWtI2.d.mts → types-_zWJTgv0.d.mts} +1 -1
  154. package/package.json +6 -6
  155. package/dist/server/chunk-3KKZVGH4.mjs +0 -179
  156. package/dist/server/chunk-3KKZVGH4.mjs.map +0 -1
  157. package/dist/server/chunk-4Z3GPTCS.js +0 -179
  158. package/dist/server/chunk-4Z3GPTCS.js.map +0 -1
  159. package/dist/server/chunk-JB4LIEFS.js.map +0 -1
  160. package/dist/server/chunk-QQ6U4QX6.js +0 -120
  161. package/dist/server/chunk-QQ6U4QX6.js.map +0 -1
  162. package/dist/server/chunk-R5YGLRUG.mjs +0 -122
  163. package/dist/server/chunk-R5YGLRUG.mjs.map +0 -1
  164. package/dist/server/chunk-SW7LE4M3.js.map +0 -1
  165. package/dist/server/chunk-W3K7LVPS.mjs +0 -120
  166. package/dist/server/chunk-W3K7LVPS.mjs.map +0 -1
  167. package/dist/server/chunk-YHEZMVTS.js +0 -122
  168. package/dist/server/chunk-YHEZMVTS.js.map +0 -1
  169. package/dist/server/loadPage-DVH3DW6E.js +0 -9
  170. package/dist/server/loadPage-DVH3DW6E.js.map +0 -1
  171. package/dist/server/loadPage-PHQZ6XQZ.mjs +0 -9
  172. package/dist/server/types-C6gmRHLe.d.mts +0 -150
  173. package/dist/server/types-C6gmRHLe.d.ts +0 -150
  174. /package/dist/server/{loadPage-PHQZ6XQZ.mjs.map → chunk-BJTO5JO5.mjs.map} +0 -0
  175. /package/dist/server/{chunk-2RW5HAQQ.mjs.map → chunk-JTAERCX2.mjs.map} +0 -0
  176. /package/dist/server/{chunk-PEAXKTDU.mjs.map → chunk-OP2GHK27.mjs.map} +0 -0
@@ -0,0 +1,2111 @@
1
+ import {
2
+ __require
3
+ } from "./chunk-BJTO5JO5.mjs";
4
+
5
+ // ../api/src/endpoints.ts
6
+ var ENDPOINT_DEFINITIONS = {
7
+ // AI endpoints - no cache due to dynamic nature
8
+ aiContentUpdateChat: {
9
+ path: "/ai/content-update-chat",
10
+ method: "POST",
11
+ auth: "user",
12
+ responseKind: "stream"
13
+ },
14
+ aiChat: {
15
+ path: "/ai/chat",
16
+ method: "POST",
17
+ auth: "user",
18
+ responseKind: "stream"
19
+ },
20
+ applySeoChanges: {
21
+ path: "/seo/apply",
22
+ method: "POST",
23
+ auth: "user",
24
+ responseKind: "json"
25
+ },
26
+ aiCreateBriefChat: {
27
+ path: "/ai/chat/create-brief",
28
+ method: "POST",
29
+ auth: "user",
30
+ responseKind: "json"
31
+ },
32
+ aiPrototypeChat: {
33
+ path: "/ai/chat/create-prototype",
34
+ method: "POST",
35
+ revalidate: 30,
36
+ // Short cache for AI responses to avoid duplicate calls
37
+ tags: ["ai-prototype"],
38
+ auth: "user",
39
+ responseKind: "json"
40
+ },
41
+ aiPatchDryRun: {
42
+ path: "/ai/patch/dry-run",
43
+ method: "POST",
44
+ auth: "user",
45
+ responseKind: "json"
46
+ },
47
+ aiPatchApply: {
48
+ path: "/ai/patch/apply",
49
+ method: "POST",
50
+ auth: "user",
51
+ responseKind: "json"
52
+ },
53
+ aiPlaygroundPropose: {
54
+ path: "/sites/{siteId}/ai/playground/propose",
55
+ method: "POST",
56
+ auth: "user",
57
+ responseKind: "json"
58
+ },
59
+ // Admin SEO
60
+ listGscPropertiesAdmin: {
61
+ path: "/admin/seo/gsc/properties",
62
+ method: "GET",
63
+ auth: "admin",
64
+ responseKind: "json"
65
+ },
66
+ adminSetGscPersist: {
67
+ path: "/admin/seo/gsc/meta/persist",
68
+ method: "POST",
69
+ auth: "admin",
70
+ responseKind: "json"
71
+ },
72
+ adminStartGscVerification: {
73
+ path: "/admin/seo/gsc/properties/verify/start",
74
+ method: "POST",
75
+ auth: "admin",
76
+ responseKind: "json"
77
+ },
78
+ adminConfirmGscVerification: {
79
+ path: "/admin/seo/gsc/properties/verify/confirm",
80
+ method: "POST",
81
+ auth: "admin",
82
+ responseKind: "json"
83
+ },
84
+ adminRunGscIngest: {
85
+ path: "/admin/seo/ingest/run",
86
+ method: "POST",
87
+ auth: "admin",
88
+ responseKind: "json"
89
+ },
90
+ getSeoVerificationMeta: {
91
+ path: "/public/seo/verification/meta",
92
+ method: "GET",
93
+ auth: "public",
94
+ responseKind: "json"
95
+ },
96
+ checkRedirect: {
97
+ path: "/api/public/content/redirect",
98
+ method: "GET",
99
+ revalidate: 86400,
100
+ // 24 hours - redirects rarely change
101
+ tags: ["redirect"],
102
+ auth: "public",
103
+ responseKind: "json"
104
+ },
105
+ listRedirectRules: {
106
+ path: "/sites/{siteId}/redirects",
107
+ method: "GET",
108
+ auth: "user",
109
+ responseKind: "json"
110
+ },
111
+ createRedirectRule: {
112
+ path: "/sites/{siteId}/redirects",
113
+ method: "POST",
114
+ auth: "user",
115
+ responseKind: "json"
116
+ },
117
+ deleteRedirectRule: {
118
+ path: "/sites/{siteId}/redirects/{ruleId}",
119
+ method: "DELETE",
120
+ auth: "user",
121
+ responseKind: "json"
122
+ },
123
+ // API Keys (Account-level - DEPRECATED, use site-scoped endpoints)
124
+ listApiKeys: {
125
+ path: "/account/api-keys",
126
+ method: "GET",
127
+ auth: "user",
128
+ responseKind: "json"
129
+ },
130
+ createApiKey: {
131
+ path: "/account/api-keys",
132
+ method: "POST",
133
+ auth: "user",
134
+ responseKind: "json"
135
+ },
136
+ revokeApiKey: {
137
+ path: "/account/api-keys/{keyId}",
138
+ method: "DELETE",
139
+ auth: "user",
140
+ responseKind: "json"
141
+ },
142
+ // API Keys (Site-scoped - preferred)
143
+ listSiteApiKeys: {
144
+ path: "/sites/{siteId}/api-keys",
145
+ method: "GET",
146
+ auth: "user",
147
+ tags: ["site-{siteId}", "api-keys"],
148
+ responseKind: "json"
149
+ },
150
+ createSiteApiKey: {
151
+ path: "/sites/{siteId}/api-keys",
152
+ method: "POST",
153
+ auth: "user",
154
+ tags: ["site-{siteId}", "api-keys"],
155
+ responseKind: "json"
156
+ },
157
+ revokeSiteApiKey: {
158
+ path: "/sites/{siteId}/api-keys/{keyId}",
159
+ method: "DELETE",
160
+ auth: "user",
161
+ tags: ["site-{siteId}", "api-keys"],
162
+ responseKind: "json"
163
+ },
164
+ getSitePreviewKey: {
165
+ path: "/sites/{siteId}/api-keys/preview",
166
+ method: "GET",
167
+ auth: "user",
168
+ tags: ["site-{siteId}", "api-keys", "preview-key"],
169
+ responseKind: "json"
170
+ },
171
+ regenerateSitePreviewKey: {
172
+ path: "/sites/{siteId}/api-keys/preview/regenerate",
173
+ method: "POST",
174
+ auth: "user",
175
+ tags: ["site-{siteId}", "api-keys", "preview-key"],
176
+ responseKind: "json"
177
+ },
178
+ getSiteApiKeyAccessLogs: {
179
+ path: "/sites/{siteId}/api-keys/access-logs",
180
+ method: "GET",
181
+ auth: "user",
182
+ tags: ["site-{siteId}", "api-keys", "access-logs"],
183
+ responseKind: "json"
184
+ },
185
+ getBookingSettings: {
186
+ path: "/sites/{siteId}/bookings/settings",
187
+ method: "GET",
188
+ auth: "user",
189
+ responseKind: "json"
190
+ },
191
+ updateBookingSettings: {
192
+ path: "/sites/{siteId}/bookings/settings",
193
+ method: "PUT",
194
+ auth: "user",
195
+ responseKind: "json"
196
+ },
197
+ listAppointmentResources: {
198
+ path: "/sites/{siteId}/bookings/resources",
199
+ method: "GET",
200
+ auth: "user",
201
+ responseKind: "json"
202
+ },
203
+ createAppointmentResource: {
204
+ path: "/sites/{siteId}/bookings/resources",
205
+ method: "POST",
206
+ auth: "user",
207
+ responseKind: "json"
208
+ },
209
+ getAppointmentResource: {
210
+ path: "/sites/{siteId}/bookings/resources/{resourceId}",
211
+ method: "GET",
212
+ auth: "user",
213
+ responseKind: "json"
214
+ },
215
+ updateAppointmentResource: {
216
+ path: "/sites/{siteId}/bookings/resources/{resourceId}",
217
+ method: "PUT",
218
+ auth: "user",
219
+ responseKind: "json"
220
+ },
221
+ deleteAppointmentResource: {
222
+ path: "/sites/{siteId}/bookings/resources/{resourceId}",
223
+ method: "DELETE",
224
+ auth: "user",
225
+ responseKind: "json"
226
+ },
227
+ listAppointmentServices: {
228
+ path: "/sites/{siteId}/bookings/services",
229
+ method: "GET",
230
+ auth: "user",
231
+ responseKind: "json"
232
+ },
233
+ createAppointmentService: {
234
+ path: "/sites/{siteId}/bookings/services",
235
+ method: "POST",
236
+ auth: "user",
237
+ responseKind: "json"
238
+ },
239
+ getAppointmentService: {
240
+ path: "/sites/{siteId}/bookings/services/{serviceId}",
241
+ method: "GET",
242
+ auth: "user",
243
+ responseKind: "json"
244
+ },
245
+ updateAppointmentService: {
246
+ path: "/sites/{siteId}/bookings/services/{serviceId}",
247
+ method: "PUT",
248
+ auth: "user",
249
+ responseKind: "json"
250
+ },
251
+ deleteAppointmentService: {
252
+ path: "/sites/{siteId}/bookings/services/{serviceId}",
253
+ method: "DELETE",
254
+ auth: "user",
255
+ responseKind: "json"
256
+ },
257
+ getAppointmentServicesReference: {
258
+ path: "/sites/{siteId}/bookings/services/reference",
259
+ method: "GET",
260
+ auth: "user",
261
+ responseKind: "json"
262
+ },
263
+ getAppointmentResourcesReference: {
264
+ path: "/sites/{siteId}/bookings/resources/reference",
265
+ method: "GET",
266
+ auth: "user",
267
+ responseKind: "json"
268
+ },
269
+ // Service-Resource linking
270
+ getResourceServices: {
271
+ path: "/sites/{siteId}/bookings/resources/{resourceId}/services",
272
+ method: "GET",
273
+ auth: "user",
274
+ responseKind: "json"
275
+ },
276
+ updateResourceServices: {
277
+ path: "/sites/{siteId}/bookings/resources/{resourceId}/services",
278
+ method: "PUT",
279
+ auth: "user",
280
+ responseKind: "json"
281
+ },
282
+ getServiceResources: {
283
+ path: "/sites/{siteId}/bookings/services/{serviceId}/resources",
284
+ method: "GET",
285
+ auth: "user",
286
+ responseKind: "json"
287
+ },
288
+ updateServiceResources: {
289
+ path: "/sites/{siteId}/bookings/services/{serviceId}/resources",
290
+ method: "PUT",
291
+ auth: "user",
292
+ responseKind: "json"
293
+ },
294
+ // Availability management
295
+ listAvailabilityRules: {
296
+ path: "/sites/{siteId}/bookings/resources/{resourceId}/availability",
297
+ method: "GET",
298
+ auth: "user",
299
+ responseKind: "json"
300
+ },
301
+ upsertAvailabilityRule: {
302
+ path: "/sites/{siteId}/bookings/resources/{resourceId}/availability",
303
+ method: "POST",
304
+ auth: "user",
305
+ responseKind: "json"
306
+ },
307
+ deleteAvailabilityRule: {
308
+ path: "/sites/{siteId}/bookings/resources/{resourceId}/availability/{ruleId}",
309
+ method: "DELETE",
310
+ auth: "user",
311
+ responseKind: "json"
312
+ },
313
+ listBlackouts: {
314
+ path: "/sites/{siteId}/bookings/resources/{resourceId}/blackouts",
315
+ method: "GET",
316
+ auth: "user",
317
+ responseKind: "json"
318
+ },
319
+ createBlackout: {
320
+ path: "/sites/{siteId}/bookings/resources/{resourceId}/blackouts",
321
+ method: "POST",
322
+ auth: "user",
323
+ responseKind: "json"
324
+ },
325
+ deleteBlackout: {
326
+ path: "/sites/{siteId}/bookings/resources/{resourceId}/blackouts/{blackoutId}",
327
+ method: "DELETE",
328
+ auth: "user",
329
+ responseKind: "json"
330
+ },
331
+ getAvailableSlots: {
332
+ path: "/sites/{siteId}/bookings/availability/slots",
333
+ method: "GET",
334
+ auth: "user",
335
+ responseKind: "json"
336
+ },
337
+ createAppointment: {
338
+ path: "/sites/{siteId}/bookings/appointments",
339
+ method: "POST",
340
+ auth: "user",
341
+ responseKind: "json"
342
+ },
343
+ // Data retrieval endpoints - good candidates for caching
344
+ getBrief: {
345
+ path: "/briefs",
346
+ method: "GET",
347
+ revalidate: 120,
348
+ // 2 minutes
349
+ tags: ["brief"],
350
+ auth: "user",
351
+ responseKind: "json"
352
+ },
353
+ // Unified site data endpoint - use this for all site lookups
354
+ getSite: {
355
+ path: "/sites",
356
+ method: "GET",
357
+ revalidate: 900,
358
+ // 15 minutes - site data changes less frequently
359
+ tags: ["site"],
360
+ auth: "user",
361
+ responseKind: "json"
362
+ },
363
+ // DEPRECATED: Use getSite with ?slug={slug} instead
364
+ getSiteBySlug: {
365
+ path: "/sites/by-slug/{slug}",
366
+ method: "GET",
367
+ revalidate: 900,
368
+ // 15 minutes - site data changes less frequently
369
+ tags: ["site", "site-{slug}"],
370
+ auth: "user",
371
+ responseKind: "json"
372
+ },
373
+ // DEPRECATED: Use getSite with ?domain={domain} instead
374
+ getSiteByDomain: {
375
+ path: "/sites/by-domain/{domain}",
376
+ method: "GET",
377
+ revalidate: 900,
378
+ // 15 minutes - site data changes less frequently
379
+ tags: ["site", "site-domain-{domain}"],
380
+ auth: "user",
381
+ responseKind: "json"
382
+ },
383
+ createBriefTurn: {
384
+ path: "/brief-turns",
385
+ method: "POST",
386
+ tags: ["brief"],
387
+ // Tags for invalidation after mutation
388
+ auth: "user",
389
+ responseKind: "json"
390
+ },
391
+ upsertBrief: {
392
+ path: "/briefs",
393
+ method: "PUT",
394
+ tags: ["brief"],
395
+ auth: "user",
396
+ responseKind: "json"
397
+ },
398
+ aiBriefToSpec: {
399
+ path: "/ai/actions/brief-to-spec",
400
+ method: "POST",
401
+ tags: ["brief", "spec"],
402
+ auth: "user",
403
+ responseKind: "json"
404
+ },
405
+ createSite: {
406
+ path: "/sites",
407
+ method: "POST",
408
+ tags: ["site"],
409
+ auth: "user",
410
+ responseKind: "json"
411
+ },
412
+ createSiteManual: {
413
+ path: "/sites/manual",
414
+ method: "POST",
415
+ tags: ["site"],
416
+ auth: "user",
417
+ responseKind: "json"
418
+ },
419
+ updateSite: {
420
+ path: "/sites",
421
+ method: "PUT",
422
+ tags: ["site"],
423
+ auth: "user",
424
+ responseKind: "json"
425
+ },
426
+ deleteSite: {
427
+ path: "/sites/{siteId}",
428
+ method: "DELETE",
429
+ tags: ["site", "site-{siteId}"],
430
+ auth: "user",
431
+ responseKind: "json"
432
+ },
433
+ listSiteMembers: {
434
+ path: "/sites/{siteId}/members",
435
+ method: "GET",
436
+ tags: ["site-{siteId}", "site-members-{siteId}"],
437
+ auth: "user",
438
+ responseKind: "json"
439
+ },
440
+ inviteSiteMember: {
441
+ path: "/sites/{siteId}/members",
442
+ method: "POST",
443
+ tags: ["site-{siteId}", "site-members-{siteId}"],
444
+ auth: "user",
445
+ responseKind: "json"
446
+ },
447
+ updateSiteMemberRole: {
448
+ path: "/sites/{siteId}/members/{memberId}",
449
+ method: "PATCH",
450
+ tags: ["site-{siteId}", "site-members-{siteId}", "site-member-{memberId}"],
451
+ auth: "user",
452
+ responseKind: "json"
453
+ },
454
+ authLogin: {
455
+ path: "/auth/login/submit",
456
+ method: "POST",
457
+ tags: ["auth"],
458
+ auth: "public",
459
+ responseKind: "json"
460
+ },
461
+ authForgotPassword: {
462
+ path: "/auth/forgot/submit",
463
+ method: "POST",
464
+ tags: ["auth"],
465
+ auth: "public",
466
+ responseKind: "json"
467
+ },
468
+ authRegister: {
469
+ path: "/auth/register/submit",
470
+ method: "POST",
471
+ tags: ["auth"],
472
+ auth: "public",
473
+ responseKind: "json"
474
+ },
475
+ authReauthenticate: {
476
+ path: "/auth/reauth/submit",
477
+ method: "POST",
478
+ tags: ["auth"],
479
+ auth: "public",
480
+ responseKind: "json"
481
+ },
482
+ lookupSiteDomains: {
483
+ path: "/sites/{siteId}/domains/lookup",
484
+ method: "POST",
485
+ tags: ["site-{siteId}", "site-domains"],
486
+ auth: "user",
487
+ responseKind: "json"
488
+ },
489
+ registerSiteDomain: {
490
+ path: "/sites/{siteId}/domains/register",
491
+ method: "POST",
492
+ tags: ["site-{siteId}", "site-domains"],
493
+ auth: "user",
494
+ responseKind: "json"
495
+ },
496
+ addCustomDomain: {
497
+ path: "/sites/{siteId}/domains/custom",
498
+ method: "POST",
499
+ tags: ["site-{siteId}", "site-domains"],
500
+ auth: "user",
501
+ responseKind: "json"
502
+ },
503
+ removeCustomDomain: {
504
+ path: "/sites/{siteId}/domains/custom",
505
+ method: "DELETE",
506
+ tags: ["site-{siteId}", "site-domains"],
507
+ auth: "user",
508
+ responseKind: "json"
509
+ },
510
+ syncCustomDomainToEdgeConfig: {
511
+ path: "/sites/{siteId}/domains/custom/sync",
512
+ method: "POST",
513
+ tags: ["site-{siteId}", "site-domains"],
514
+ auth: "user",
515
+ responseKind: "json"
516
+ },
517
+ removeSiteMember: {
518
+ path: "/sites/{siteId}/members/{memberId}",
519
+ method: "DELETE",
520
+ tags: ["site-{siteId}", "site-members-{siteId}", "site-member-{memberId}"],
521
+ auth: "user",
522
+ responseKind: "json"
523
+ },
524
+ revokeSiteInvitation: {
525
+ path: "/sites/{siteId}/members/invitations/{invitationId}",
526
+ method: "DELETE",
527
+ tags: ["site-{siteId}", "site-members-{siteId}", "site-invite-{invitationId}"],
528
+ auth: "user",
529
+ responseKind: "json"
530
+ },
531
+ transferSiteOwnership: {
532
+ path: "/sites/{siteId}/members/transfer-ownership",
533
+ method: "POST",
534
+ tags: ["site-{siteId}", "site-members-{siteId}"],
535
+ auth: "user",
536
+ responseKind: "json"
537
+ },
538
+ listContentEntries: {
539
+ path: "/sites/{siteId}/content/{type}",
540
+ method: "GET",
541
+ revalidate: 60,
542
+ tags: ["site-{siteId}", "content-{siteId}-{type}"],
543
+ auth: "user",
544
+ responseKind: "json"
545
+ },
546
+ getContentTemplate: {
547
+ path: "/sites/{siteId}/content/types/{type}/template",
548
+ method: "GET",
549
+ revalidate: 60,
550
+ tags: ["site-{siteId}", "content-template-{siteId}-{type}"],
551
+ auth: "user",
552
+ responseKind: "json"
553
+ },
554
+ updateContentTemplateBlock: {
555
+ path: "/sites/{siteId}/content/types/{type}/template/blocks/{blockId}",
556
+ method: "PATCH",
557
+ tags: ["site-{siteId}", "content-template-{siteId}-{type}", "content-template-block-{blockId}"],
558
+ auth: "user",
559
+ responseKind: "json"
560
+ },
561
+ applyContentTemplateAddon: {
562
+ path: "/sites/{siteId}/content/types/{type}/template/addons",
563
+ method: "POST",
564
+ tags: ["site-{siteId}", "content-template-{siteId}-{type}"],
565
+ auth: "user",
566
+ responseKind: "json"
567
+ },
568
+ updateContentTemplateBlockBindings: {
569
+ path: "/sites/{siteId}/content/types/{type}/template/blocks/{blockId}/bindings",
570
+ method: "PATCH",
571
+ tags: ["site-{siteId}", "content-template-{siteId}-{type}", "content-template-block-{blockId}"],
572
+ auth: "user",
573
+ responseKind: "json"
574
+ },
575
+ createTemplateBlock: {
576
+ path: "/sites/{siteId}/content/types/{type}/template/blocks",
577
+ method: "POST",
578
+ tags: ["site-{siteId}", "content-template-{siteId}-{type}"],
579
+ auth: "user",
580
+ responseKind: "json"
581
+ },
582
+ deleteTemplateBlock: {
583
+ path: "/sites/{siteId}/content/types/{type}/template/blocks/{blockId}",
584
+ method: "DELETE",
585
+ tags: ["site-{siteId}", "content-template-{siteId}-{type}", "content-template-block-{blockId}"],
586
+ auth: "user",
587
+ responseKind: "json"
588
+ },
589
+ reorderTemplateBlocks: {
590
+ path: "/sites/{siteId}/content/types/{type}/template/blocks/reorder",
591
+ method: "POST",
592
+ tags: ["site-{siteId}", "content-template-{siteId}-{type}"],
593
+ auth: "user",
594
+ responseKind: "json"
595
+ },
596
+ getTransforms: {
597
+ path: "/transforms",
598
+ method: "GET",
599
+ revalidate: 3600,
600
+ tags: ["transforms"],
601
+ auth: "public",
602
+ responseKind: "json"
603
+ },
604
+ createContentEntry: {
605
+ path: "/sites/{siteId}/content/{type}",
606
+ method: "POST",
607
+ tags: ["site-{siteId}", "content-{siteId}-{type}"],
608
+ auth: "user",
609
+ responseKind: "json"
610
+ },
611
+ getContentEntry: {
612
+ path: "/sites/{siteId}/content/{type}/{entryId}",
613
+ method: "GET",
614
+ tags: ["site-{siteId}", "content-{siteId}-{type}", "content-entry-{entryId}"],
615
+ auth: "user",
616
+ responseKind: "json"
617
+ },
618
+ updateContentEntry: {
619
+ path: "/sites/{siteId}/content/{type}/{entryId}",
620
+ method: "PUT",
621
+ tags: ["site-{siteId}", "content-{siteId}-{type}", "content-entry-{entryId}"],
622
+ auth: "user",
623
+ responseKind: "json"
624
+ },
625
+ updateContentEntryContent: {
626
+ path: "/sites/{siteId}/content/{type}/{entryId}/content",
627
+ method: "PUT",
628
+ tags: ["site-{siteId}", "content-{siteId}-{type}", "content-entry-{entryId}"],
629
+ auth: "user",
630
+ responseKind: "json"
631
+ },
632
+ updateRouteMetadata: {
633
+ path: "/sites/{siteId}/routes/{routeId}/metadata",
634
+ method: "PATCH",
635
+ tags: ["site-{siteId}", "route-{routeId}"],
636
+ auth: "user",
637
+ responseKind: "json"
638
+ },
639
+ publishContentEntry: {
640
+ path: "/sites/{siteId}/content/{type}/{entryId}/publish",
641
+ method: "POST",
642
+ tags: ["site-{siteId}", "content-{siteId}-{type}", "content-entry-{entryId}"],
643
+ auth: "user",
644
+ responseKind: "json"
645
+ },
646
+ discardContentEntry: {
647
+ path: "/sites/{siteId}/content/{type}/{entryId}/discard",
648
+ method: "POST",
649
+ tags: ["site-{siteId}", "content-{siteId}-{type}", "content-entry-{entryId}"],
650
+ auth: "user",
651
+ responseKind: "json"
652
+ },
653
+ unpublishContentEntry: {
654
+ path: "/sites/{siteId}/content/{type}/{entryId}/unpublish",
655
+ method: "POST",
656
+ tags: ["site-{siteId}", "content-{siteId}-{type}", "content-entry-{entryId}"],
657
+ auth: "user",
658
+ responseKind: "json"
659
+ },
660
+ // Content types: enable + setup
661
+ listContentTypes: {
662
+ path: "/sites/{siteId}/content-types",
663
+ method: "GET",
664
+ revalidate: 120,
665
+ // 2 minutes
666
+ tags: ["site-{siteId}", "content-types"],
667
+ auth: "user",
668
+ responseKind: "json"
669
+ },
670
+ enableContentType: {
671
+ path: "/sites/{siteId}/content-types/{key}/enable",
672
+ method: "POST",
673
+ tags: ["site-{siteId}", "content-types", "content-type-{key}"],
674
+ auth: "user",
675
+ responseKind: "json"
676
+ },
677
+ setupContentType: {
678
+ path: "/sites/{siteId}/content-types/{key}/setup",
679
+ method: "POST",
680
+ tags: ["site-{siteId}", "content-types", "content-type-{key}"],
681
+ auth: "user",
682
+ responseKind: "json"
683
+ },
684
+ deleteContentEntry: {
685
+ path: "/sites/{siteId}/content/{type}/{entryId}",
686
+ method: "DELETE",
687
+ tags: ["site-{siteId}", "content-{siteId}-{type}", "content-entry-{entryId}"],
688
+ auth: "user",
689
+ responseKind: "json"
690
+ },
691
+ updateSiteGeneralSettings: {
692
+ path: "/sites/{siteId}/settings/general",
693
+ method: "POST",
694
+ tags: ["site-{siteId}", "site-settings-{siteId}"],
695
+ auth: "user",
696
+ responseKind: "json"
697
+ },
698
+ getSiteLayoutSettings: {
699
+ path: "/sites/{siteId}/settings/layout",
700
+ method: "GET",
701
+ revalidate: 120,
702
+ tags: ["site-{siteId}", "site-settings-{siteId}"],
703
+ auth: "user",
704
+ responseKind: "json"
705
+ },
706
+ updateSiteLayoutSettings: {
707
+ path: "/sites/{siteId}/settings/layout",
708
+ method: "POST",
709
+ tags: ["site-{siteId}", "site-settings-{siteId}"],
710
+ auth: "user",
711
+ responseKind: "json"
712
+ },
713
+ getMaintenanceSettings: {
714
+ path: "/sites/{siteId}/settings/maintenance",
715
+ method: "GET",
716
+ revalidate: 120,
717
+ tags: ["site-{siteId}", "site-settings-{siteId}"],
718
+ auth: "user",
719
+ responseKind: "json"
720
+ },
721
+ updateMaintenanceSettings: {
722
+ path: "/sites/{siteId}/settings/maintenance",
723
+ method: "POST",
724
+ tags: ["site-{siteId}", "site-settings-{siteId}"],
725
+ auth: "user",
726
+ responseKind: "json"
727
+ },
728
+ setHomepage: {
729
+ path: "/sites/{siteId}/settings/homepage",
730
+ method: "POST",
731
+ tags: ["site-{siteId}", "site-homepage"],
732
+ auth: "user",
733
+ responseKind: "json"
734
+ },
735
+ listAccountDomains: {
736
+ path: "/domains",
737
+ method: "GET",
738
+ tags: ["domains"],
739
+ auth: "user",
740
+ responseKind: "json"
741
+ },
742
+ searchDomains: {
743
+ path: "/domains/search",
744
+ method: "POST",
745
+ tags: ["domains"],
746
+ auth: "user",
747
+ responseKind: "json"
748
+ },
749
+ registerDomain: {
750
+ path: "/domains/register",
751
+ method: "POST",
752
+ tags: ["domains"],
753
+ auth: "user",
754
+ responseKind: "json"
755
+ },
756
+ assignDomain: {
757
+ path: "/domains/{domainId}/assign",
758
+ method: "POST",
759
+ tags: ["domains", "domain-{domainId}"],
760
+ auth: "user",
761
+ responseKind: "json"
762
+ },
763
+ adminStartImpersonation: {
764
+ path: "/admin/impersonation/start",
765
+ method: "POST",
766
+ tags: ["admin", "impersonation"],
767
+ auth: "user",
768
+ responseKind: "json"
769
+ },
770
+ adminStopImpersonation: {
771
+ path: "/admin/impersonation/stop",
772
+ method: "POST",
773
+ tags: ["admin", "impersonation"],
774
+ auth: "user",
775
+ responseKind: "json"
776
+ },
777
+ adminAssignRole: {
778
+ path: "/admin/roles/assign",
779
+ method: "POST",
780
+ tags: ["admin", "roles"],
781
+ auth: "user",
782
+ responseKind: "json"
783
+ },
784
+ adminRevokeRole: {
785
+ path: "/admin/roles/revoke",
786
+ method: "POST",
787
+ tags: ["admin", "roles"],
788
+ auth: "user",
789
+ responseKind: "json"
790
+ },
791
+ adminChangePlan: {
792
+ path: "/admin/billing/plan",
793
+ method: "POST",
794
+ tags: ["admin", "billing"],
795
+ auth: "user",
796
+ responseKind: "json"
797
+ },
798
+ changePlan: {
799
+ path: "/billing/plan/change",
800
+ method: "POST",
801
+ tags: ["billing"],
802
+ auth: "user",
803
+ responseKind: "json"
804
+ },
805
+ mfaTotpEnroll: {
806
+ path: "/auth/mfa/totp/enroll",
807
+ method: "POST",
808
+ tags: ["mfa"],
809
+ auth: "user",
810
+ responseKind: "json"
811
+ },
812
+ mfaTotpVerify: {
813
+ path: "/auth/mfa/totp/verify",
814
+ method: "POST",
815
+ tags: ["mfa"],
816
+ auth: "user",
817
+ responseKind: "json"
818
+ },
819
+ mfaTotpActivate: {
820
+ path: "/auth/mfa/totp/activate",
821
+ method: "POST",
822
+ tags: ["mfa"],
823
+ auth: "user",
824
+ responseKind: "json"
825
+ },
826
+ mfaDeleteFactor: {
827
+ path: "/auth/mfa/factors/{factorId}",
828
+ method: "DELETE",
829
+ tags: ["mfa"],
830
+ auth: "user",
831
+ responseKind: "json"
832
+ },
833
+ mfaBackupCodesGet: {
834
+ path: "/auth/mfa/backup-codes",
835
+ method: "GET",
836
+ tags: ["mfa"],
837
+ auth: "user",
838
+ responseKind: "json"
839
+ },
840
+ mfaBackupCodesRotate: {
841
+ path: "/auth/mfa/backup-codes/rotate",
842
+ method: "POST",
843
+ tags: ["mfa"],
844
+ auth: "user",
845
+ responseKind: "json"
846
+ },
847
+ mfaPhoneEnroll: {
848
+ path: "/auth/mfa/phone/enroll",
849
+ method: "POST",
850
+ tags: ["mfa"],
851
+ auth: "user",
852
+ responseKind: "json"
853
+ },
854
+ mfaPhoneChallenge: {
855
+ path: "/auth/mfa/phone/challenge",
856
+ method: "POST",
857
+ tags: ["mfa"],
858
+ auth: "user",
859
+ responseKind: "json"
860
+ },
861
+ mfaPhoneVerify: {
862
+ path: "/auth/mfa/phone/verify",
863
+ method: "POST",
864
+ tags: ["mfa"],
865
+ auth: "user",
866
+ responseKind: "json"
867
+ },
868
+ accountUpdatePassword: {
869
+ path: "/account/password/update",
870
+ method: "POST",
871
+ tags: ["account"],
872
+ auth: "user",
873
+ responseKind: "json"
874
+ },
875
+ accountRevokeSessions: {
876
+ path: "/account/sessions/revoke",
877
+ method: "POST",
878
+ tags: ["account"],
879
+ auth: "user",
880
+ responseKind: "json"
881
+ },
882
+ adminListInvites: {
883
+ path: "/admin/invites",
884
+ method: "GET",
885
+ tags: ["admin", "invites"],
886
+ auth: "user",
887
+ responseKind: "json"
888
+ },
889
+ adminCreateInvite: {
890
+ path: "/admin/invites",
891
+ method: "POST",
892
+ tags: ["admin", "invites"],
893
+ auth: "user",
894
+ responseKind: "json"
895
+ },
896
+ adminRevokeInvite: {
897
+ path: "/admin/invites/{inviteId}",
898
+ method: "DELETE",
899
+ tags: ["admin", "invites"],
900
+ auth: "user",
901
+ responseKind: "json"
902
+ },
903
+ adminCreateUser: {
904
+ path: "/admin/users",
905
+ method: "POST",
906
+ tags: ["admin", "users"],
907
+ auth: "admin",
908
+ responseKind: "json"
909
+ },
910
+ adminListAllowedDomains: {
911
+ path: "/admin/allowed-domains",
912
+ method: "GET",
913
+ tags: ["admin", "allowed-domains"],
914
+ auth: "user",
915
+ responseKind: "json"
916
+ },
917
+ adminAddAllowedDomain: {
918
+ path: "/admin/allowed-domains",
919
+ method: "POST",
920
+ tags: ["admin", "allowed-domains"],
921
+ auth: "user",
922
+ responseKind: "json"
923
+ },
924
+ adminDeleteAllowedDomain: {
925
+ path: "/admin/allowed-domains/{domainId}",
926
+ method: "DELETE",
927
+ tags: ["admin", "allowed-domains"],
928
+ auth: "user",
929
+ responseKind: "json"
930
+ },
931
+ authAcceptInvite: {
932
+ path: "/auth/invite/accept",
933
+ method: "POST",
934
+ tags: ["auth", "invite"],
935
+ auth: "user",
936
+ responseKind: "json"
937
+ },
938
+ acceptSiteInvitation: {
939
+ path: "/sites/invitations/accept",
940
+ method: "POST",
941
+ tags: ["site-invitations"],
942
+ auth: "user",
943
+ responseKind: "json"
944
+ },
945
+ getNavigationMenus: {
946
+ path: "/sites/{siteId}/navigation/menus",
947
+ method: "GET",
948
+ tags: ["site-{siteId}", "navigation"],
949
+ auth: "user",
950
+ responseKind: "json"
951
+ },
952
+ createNavigationMenu: {
953
+ path: "/sites/{siteId}/navigation/menus",
954
+ method: "POST",
955
+ tags: ["site-{siteId}", "navigation"],
956
+ auth: "user",
957
+ responseKind: "json"
958
+ },
959
+ updateNavigationMenu: {
960
+ path: "/sites/{siteId}/navigation/menus/{menuId}",
961
+ method: "PATCH",
962
+ tags: ["site-{siteId}", "navigation", "navigation-menu-{menuId}"],
963
+ auth: "user",
964
+ responseKind: "json"
965
+ },
966
+ deleteNavigationMenu: {
967
+ path: "/sites/{siteId}/navigation/menus/{menuId}",
968
+ method: "DELETE",
969
+ tags: ["site-{siteId}", "navigation", "navigation-menu-{menuId}"],
970
+ auth: "user",
971
+ responseKind: "json"
972
+ },
973
+ createNavigationItem: {
974
+ path: "/sites/{siteId}/navigation/menus/{menuId}/items",
975
+ method: "POST",
976
+ tags: ["site-{siteId}", "navigation", "navigation-menu-{menuId}"],
977
+ auth: "user",
978
+ responseKind: "json"
979
+ },
980
+ updateNavigationItem: {
981
+ path: "/sites/{siteId}/navigation/menus/{menuId}/items/{itemId}",
982
+ method: "PATCH",
983
+ tags: ["site-{siteId}", "navigation", "navigation-menu-{menuId}", "navigation-item-{itemId}"],
984
+ auth: "user",
985
+ responseKind: "json"
986
+ },
987
+ deleteNavigationItem: {
988
+ path: "/sites/{siteId}/navigation/menus/{menuId}/items/{itemId}",
989
+ method: "DELETE",
990
+ tags: ["site-{siteId}", "navigation", "navigation-menu-{menuId}", "navigation-item-{itemId}"],
991
+ auth: "user",
992
+ responseKind: "json"
993
+ },
994
+ reorderNavigationItems: {
995
+ path: "/sites/{siteId}/navigation/menus/{menuId}/items/reorder",
996
+ method: "POST",
997
+ tags: ["site-{siteId}", "navigation", "navigation-menu-{menuId}"],
998
+ auth: "user",
999
+ responseKind: "json"
1000
+ },
1001
+ getRoutableContent: {
1002
+ path: "/sites/{siteId}/routable-content",
1003
+ method: "GET",
1004
+ revalidate: 60,
1005
+ tags: ["site-{siteId}", "routable-content-{siteId}"],
1006
+ auth: "user",
1007
+ responseKind: "json"
1008
+ },
1009
+ // Generic public content preview (preferred)
1010
+ getPublishedEntryPreview: {
1011
+ path: "/public/content/{siteId}/{type}/{slug}/preview",
1012
+ method: "GET",
1013
+ revalidate: 60,
1014
+ tags: ["content-{siteId}-{type}-{slug}"],
1015
+ auth: "public",
1016
+ responseKind: "json"
1017
+ },
1018
+ listPublishedEntries: {
1019
+ path: "/public/content/{siteId}/{type}/entries",
1020
+ method: "GET",
1021
+ revalidate: 60,
1022
+ tags: ["content-{siteId}-{type}"],
1023
+ auth: "public",
1024
+ responseKind: "json"
1025
+ },
1026
+ getPublishedPostPreview: {
1027
+ path: "/public/posts/{siteId}/{slug}/preview",
1028
+ method: "GET",
1029
+ revalidate: 60,
1030
+ tags: ["blog-post:{siteId}:{slug}"],
1031
+ auth: "public",
1032
+ responseKind: "json"
1033
+ },
1034
+ proposalsSelect: {
1035
+ path: "/proposals/select",
1036
+ method: "POST",
1037
+ tags: ["proposal", "site"],
1038
+ auth: "user",
1039
+ responseKind: "json"
1040
+ },
1041
+ createTheme: {
1042
+ path: "/ai/chat/create-theme",
1043
+ method: "POST",
1044
+ revalidate: 60,
1045
+ // 1 minute cache for theme creation to avoid duplicate requests
1046
+ tags: ["theme", "ai-theme"],
1047
+ auth: "user",
1048
+ responseKind: "json"
1049
+ },
1050
+ generateThemes: {
1051
+ path: "/theme/generate",
1052
+ method: "POST",
1053
+ tags: ["theme"],
1054
+ auth: "user",
1055
+ responseKind: "json"
1056
+ },
1057
+ extractThemeFromInspiration: {
1058
+ path: "/theme/extract-from-inspiration",
1059
+ method: "POST",
1060
+ tags: ["theme", "preferences"],
1061
+ auth: "user",
1062
+ responseKind: "json"
1063
+ },
1064
+ saveSiteTheme: {
1065
+ path: "/sites/{siteId}/theme/save",
1066
+ method: "POST",
1067
+ tags: ["site-{siteId}", "theme"],
1068
+ auth: "user",
1069
+ responseKind: "json"
1070
+ },
1071
+ uploadSiteLogo: {
1072
+ path: "/storage/upload-site-logo",
1073
+ method: "POST",
1074
+ tags: ["site", "logo"],
1075
+ auth: "user",
1076
+ responseKind: "json"
1077
+ },
1078
+ upsertThemePreferences: {
1079
+ path: "/theme-preferences/upsert",
1080
+ method: "POST",
1081
+ tags: ["theme", "preferences"],
1082
+ auth: "user",
1083
+ responseKind: "json"
1084
+ },
1085
+ finalizeSite: {
1086
+ path: "/sites/finalize",
1087
+ method: "POST",
1088
+ tags: ["site"],
1089
+ auth: "user",
1090
+ responseKind: "json"
1091
+ },
1092
+ instagramUploadZip: {
1093
+ path: "/api/instagram/upload-zip",
1094
+ method: "POST",
1095
+ tags: ["instagram-import"],
1096
+ auth: "user",
1097
+ responseKind: "json"
1098
+ },
1099
+ getAnalyticsReport: {
1100
+ path: "/sites/{siteId}/analytics/report",
1101
+ method: "GET",
1102
+ revalidate: 300,
1103
+ tags: ["site-{siteId}", "analytics-{siteId}"],
1104
+ auth: "user",
1105
+ responseKind: "json"
1106
+ },
1107
+ getSeoOverview: {
1108
+ path: "/sites/{siteId}/seo/overview",
1109
+ method: "GET",
1110
+ revalidate: 300,
1111
+ tags: ["site-{siteId}", "seo-overview-{siteId}"],
1112
+ auth: "user",
1113
+ responseKind: "json"
1114
+ },
1115
+ getSeoPages: {
1116
+ path: "/sites/{siteId}/seo/pages",
1117
+ method: "GET",
1118
+ revalidate: 300,
1119
+ tags: ["site-{siteId}", "seo-pages-{siteId}"],
1120
+ auth: "user",
1121
+ responseKind: "json"
1122
+ },
1123
+ getSeoQueries: {
1124
+ path: "/sites/{siteId}/seo/queries",
1125
+ method: "GET",
1126
+ revalidate: 300,
1127
+ tags: ["site-{siteId}", "seo-queries-{siteId}"],
1128
+ auth: "user",
1129
+ responseKind: "json"
1130
+ },
1131
+ getPerformanceOverview: {
1132
+ path: "/sites/{siteId}/performance/overview",
1133
+ method: "GET",
1134
+ revalidate: 300,
1135
+ tags: ["site-{siteId}", "performance-overview-{siteId}"],
1136
+ auth: "user",
1137
+ responseKind: "json"
1138
+ },
1139
+ createMediaAsset: {
1140
+ path: "/media",
1141
+ method: "POST",
1142
+ tags: ["media"],
1143
+ auth: "user",
1144
+ responseKind: "json"
1145
+ },
1146
+ mediaList: {
1147
+ path: "/media",
1148
+ method: "GET",
1149
+ tags: ["media"],
1150
+ auth: "user",
1151
+ responseKind: "json"
1152
+ },
1153
+ mediaGet: {
1154
+ path: "/media/{assetId}",
1155
+ method: "GET",
1156
+ tags: ["media", "media-{assetId}"],
1157
+ auth: "user",
1158
+ responseKind: "json"
1159
+ },
1160
+ mediaUpdate: {
1161
+ path: "/media/{assetId}",
1162
+ method: "PATCH",
1163
+ tags: ["media", "media-{assetId}"],
1164
+ auth: "user",
1165
+ responseKind: "json"
1166
+ },
1167
+ mediaDelete: {
1168
+ path: "/media/{assetId}",
1169
+ method: "DELETE",
1170
+ tags: ["media", "media-{assetId}"],
1171
+ auth: "user",
1172
+ responseKind: "void"
1173
+ },
1174
+ mediaBulkDelete: {
1175
+ path: "/media/bulk-delete",
1176
+ method: "POST",
1177
+ tags: ["media"],
1178
+ auth: "user",
1179
+ responseKind: "json"
1180
+ },
1181
+ mediaGetSignedUrl: {
1182
+ path: "/media/{assetId}/signed-url",
1183
+ method: "GET",
1184
+ tags: ["media", "media-{assetId}"],
1185
+ auth: "user",
1186
+ responseKind: "json"
1187
+ },
1188
+ mediaUpload: {
1189
+ path: "/media/upload",
1190
+ method: "POST",
1191
+ tags: ["media"],
1192
+ auth: "user",
1193
+ responseKind: "json"
1194
+ },
1195
+ getMediaLabels: {
1196
+ path: "/media/labels",
1197
+ method: "GET",
1198
+ tags: ["media", "media-labels"],
1199
+ auth: "user",
1200
+ responseKind: "json"
1201
+ },
1202
+ getMediaSettings: {
1203
+ path: "/media/settings",
1204
+ method: "GET",
1205
+ tags: ["media-settings"],
1206
+ auth: "user",
1207
+ responseKind: "json"
1208
+ },
1209
+ updateMediaSettings: {
1210
+ path: "/media/settings",
1211
+ method: "POST",
1212
+ tags: ["media-settings"],
1213
+ auth: "user",
1214
+ responseKind: "json"
1215
+ },
1216
+ // Media endpoints
1217
+ mediaSearch: {
1218
+ path: "/media/search",
1219
+ method: "POST",
1220
+ tags: ["media-search"],
1221
+ auth: "user",
1222
+ responseKind: "json"
1223
+ },
1224
+ classifyMediaAsset: {
1225
+ path: "/media/{assetId}/classify",
1226
+ method: "POST",
1227
+ tags: ["media", "media-{assetId}"],
1228
+ auth: "user",
1229
+ responseKind: "json"
1230
+ },
1231
+ classifyMediaBatch: {
1232
+ path: "/media/classify",
1233
+ method: "POST",
1234
+ tags: ["media"],
1235
+ auth: "user",
1236
+ responseKind: "json"
1237
+ },
1238
+ mediaJobsStatus: {
1239
+ path: "/media/jobs/status",
1240
+ method: "GET",
1241
+ tags: ["media"],
1242
+ auth: "user",
1243
+ responseKind: "json"
1244
+ },
1245
+ enqueueMediaClassifyJob: {
1246
+ path: "/media/jobs",
1247
+ method: "POST",
1248
+ tags: ["media"],
1249
+ auth: "user",
1250
+ responseKind: "json"
1251
+ },
1252
+ runMediaClassifyJob: {
1253
+ path: "/media/jobs/run",
1254
+ method: "POST",
1255
+ tags: ["media"],
1256
+ auth: "user",
1257
+ responseKind: "json"
1258
+ },
1259
+ runAllMediaClassifyJobs: {
1260
+ path: "/media/jobs/run-all",
1261
+ method: "POST",
1262
+ tags: ["media"],
1263
+ auth: "user",
1264
+ responseKind: "json"
1265
+ },
1266
+ initSiteContent: {
1267
+ path: "/sites/{siteId}/content/init",
1268
+ method: "POST",
1269
+ tags: ["site", "content"],
1270
+ auth: "user",
1271
+ responseKind: "json"
1272
+ },
1273
+ updateBlockContent: {
1274
+ path: "/blocks/{blockId}/content",
1275
+ method: "POST",
1276
+ tags: ["block", "block-{blockId}", "content"],
1277
+ auth: "user",
1278
+ responseKind: "json"
1279
+ },
1280
+ saveBlockContent: {
1281
+ path: "/blocks/{blockId}/content",
1282
+ method: "POST",
1283
+ tags: ["block", "block-{blockId}", "content"],
1284
+ auth: "user",
1285
+ responseKind: "json"
1286
+ },
1287
+ createBlock: {
1288
+ path: "/sites/{siteId}/pages/{pageId}/blocks",
1289
+ method: "POST",
1290
+ tags: ["site-{siteId}", "page-{pageId}", "blocks"],
1291
+ auth: "user",
1292
+ responseKind: "json"
1293
+ },
1294
+ reorderBlocks: {
1295
+ path: "/sites/{siteId}/pages/{pageId}/blocks/reorder",
1296
+ method: "POST",
1297
+ tags: ["site-{siteId}", "page-{pageId}", "blocks"],
1298
+ auth: "user",
1299
+ responseKind: "json"
1300
+ },
1301
+ deleteBlock: {
1302
+ path: "/sites/{siteId}/pages/{pageId}/blocks/{blockId}",
1303
+ method: "DELETE",
1304
+ tags: ["site-{siteId}", "page-{pageId}", "blocks"],
1305
+ auth: "user",
1306
+ responseKind: "json"
1307
+ },
1308
+ listBlocks: {
1309
+ path: "/sites/{siteId}/pages/{pageId}/blocks",
1310
+ method: "GET",
1311
+ tags: ["site-{siteId}", "page-{pageId}", "blocks"],
1312
+ auth: "user",
1313
+ responseKind: "json"
1314
+ },
1315
+ getBlockContent: {
1316
+ path: "/blocks/{blockId}/content",
1317
+ method: "GET",
1318
+ tags: ["block-{blockId}", "content"],
1319
+ auth: "user",
1320
+ responseKind: "json"
1321
+ },
1322
+ // DEPRECATED: Use getSite with ?id={id} instead
1323
+ getSiteById: {
1324
+ path: "/sites/by-id/{id}",
1325
+ method: "GET",
1326
+ revalidate: 900,
1327
+ // 15 minutes
1328
+ tags: ["site-{id}"],
1329
+ auth: "user",
1330
+ responseKind: "json"
1331
+ },
1332
+ // Page data endpoints
1333
+ getPageById: {
1334
+ path: "/sites/{siteId}/pages/{pageId}",
1335
+ method: "GET",
1336
+ revalidate: 900,
1337
+ // 15 minutes
1338
+ tags: ["site-{siteId}", "page-{pageId}"],
1339
+ auth: "user",
1340
+ responseKind: "json"
1341
+ },
1342
+ getContentByPath: {
1343
+ path: "/sites/{siteId}/pages",
1344
+ method: "GET",
1345
+ tags: ["site-{siteId}", "routable-content-{siteId}"],
1346
+ auth: "public",
1347
+ responseKind: "json"
1348
+ },
1349
+ getPageByPath: {
1350
+ path: "/sites/{siteId}/pages",
1351
+ method: "GET",
1352
+ tags: ["site-{siteId}"],
1353
+ auth: "user",
1354
+ responseKind: "json"
1355
+ },
1356
+ // Forms CRUD
1357
+ listForms: {
1358
+ path: "/sites/{siteId}/forms",
1359
+ method: "GET",
1360
+ tags: ["site-{siteId}", "forms"],
1361
+ auth: "user",
1362
+ responseKind: "json"
1363
+ },
1364
+ listBookingForms: {
1365
+ path: "/sites/{siteId}/bookings/forms",
1366
+ method: "GET",
1367
+ tags: ["site-{siteId}", "forms"],
1368
+ auth: "user",
1369
+ responseKind: "json"
1370
+ },
1371
+ createForm: {
1372
+ path: "/sites/{siteId}/forms",
1373
+ method: "POST",
1374
+ tags: ["site-{siteId}", "forms"],
1375
+ auth: "user",
1376
+ responseKind: "json"
1377
+ },
1378
+ updateForm: {
1379
+ path: "/sites/{siteId}/forms/{slug}",
1380
+ method: "PATCH",
1381
+ tags: ["site-{siteId}", "forms", "form-{slug}"],
1382
+ auth: "user",
1383
+ responseKind: "json"
1384
+ },
1385
+ deleteForm: {
1386
+ path: "/sites/{siteId}/forms/{slug}",
1387
+ method: "DELETE",
1388
+ tags: ["site-{siteId}", "forms", "form-{slug}"],
1389
+ auth: "user",
1390
+ responseKind: "json"
1391
+ },
1392
+ listFormSubmissions: {
1393
+ path: "/sites/{siteId}/forms/{slug}/submissions",
1394
+ method: "GET",
1395
+ revalidate: 30,
1396
+ tags: ["site-{siteId}", "form-{slug}", "form-submissions-{slug}"],
1397
+ auth: "user",
1398
+ responseKind: "json"
1399
+ },
1400
+ // Public submit
1401
+ submitForm: {
1402
+ path: "/forms/submit",
1403
+ method: "POST",
1404
+ tags: ["forms-submit"],
1405
+ auth: "public",
1406
+ responseKind: "json"
1407
+ },
1408
+ // Public forms
1409
+ getPublicFormById: {
1410
+ path: "/public/forms/{formId}",
1411
+ method: "GET",
1412
+ revalidate: 60,
1413
+ tags: ["form-{formId}"],
1414
+ auth: "public",
1415
+ responseKind: "json"
1416
+ },
1417
+ // Public booking services
1418
+ getPublicBookingServices: {
1419
+ path: "/public/bookings/services",
1420
+ method: "GET",
1421
+ revalidate: 60,
1422
+ tags: ["site-{siteId}"],
1423
+ auth: "public",
1424
+ responseKind: "json"
1425
+ },
1426
+ devToolsImpersonateAdmin: {
1427
+ path: "/dev-tools/impersonate/admin",
1428
+ method: "POST",
1429
+ auth: "admin",
1430
+ responseKind: "json"
1431
+ },
1432
+ devToolsImpersonateRandom: {
1433
+ path: "/dev-tools/impersonate/random",
1434
+ method: "POST",
1435
+ auth: "admin",
1436
+ responseKind: "json"
1437
+ },
1438
+ devToolsSeedDemoData: {
1439
+ path: "/dev-tools/seed",
1440
+ method: "POST",
1441
+ auth: "admin",
1442
+ responseKind: "json"
1443
+ },
1444
+ // Public analytics collection endpoint
1445
+ analyticsCollect: {
1446
+ path: "/api/analytics/collect",
1447
+ method: "POST",
1448
+ auth: "public",
1449
+ responseKind: "json"
1450
+ },
1451
+ // Public events for event calendar block
1452
+ listPublicEvents: {
1453
+ path: "/public/sites/{siteId}/events",
1454
+ method: "GET",
1455
+ revalidate: 60,
1456
+ tags: ["public-events-{siteId}"],
1457
+ auth: "public",
1458
+ responseKind: "json"
1459
+ },
1460
+ // Public event registration
1461
+ registerForEvent: {
1462
+ path: "/public/sites/{siteId}/events/register",
1463
+ method: "POST",
1464
+ tags: ["public-events-{siteId}", "event-registration"],
1465
+ auth: "public",
1466
+ responseKind: "json"
1467
+ },
1468
+ // Content Types CRUD
1469
+ listSiteContentTypes: {
1470
+ path: "/sites/{siteId}/content-types",
1471
+ method: "GET",
1472
+ revalidate: 60,
1473
+ tags: ["site-{siteId}", "content-types-{siteId}"],
1474
+ auth: "user",
1475
+ responseKind: "json"
1476
+ },
1477
+ getContentType: {
1478
+ path: "/sites/{siteId}/content-types/by-id/{typeId}",
1479
+ method: "GET",
1480
+ revalidate: 60,
1481
+ tags: ["site-{siteId}", "content-type-{typeId}"],
1482
+ auth: "user",
1483
+ responseKind: "json"
1484
+ },
1485
+ createContentType: {
1486
+ path: "/sites/{siteId}/content-types",
1487
+ method: "POST",
1488
+ tags: ["site-{siteId}", "content-types-{siteId}"],
1489
+ auth: "user",
1490
+ responseKind: "json"
1491
+ },
1492
+ updateContentType: {
1493
+ path: "/sites/{siteId}/content-types/by-id/{typeId}",
1494
+ method: "PATCH",
1495
+ tags: ["site-{siteId}", "content-type-{typeId}", "content-types-{siteId}"],
1496
+ auth: "user",
1497
+ responseKind: "json"
1498
+ },
1499
+ deleteContentType: {
1500
+ path: "/sites/{siteId}/content-types/by-id/{typeId}",
1501
+ method: "DELETE",
1502
+ tags: ["site-{siteId}", "content-type-{typeId}", "content-types-{sideId}"],
1503
+ auth: "user",
1504
+ responseKind: "json"
1505
+ },
1506
+ duplicateContentType: {
1507
+ path: "/sites/{siteId}/content-types/by-id/{typeId}/duplicate",
1508
+ method: "POST",
1509
+ tags: ["site-{siteId}", "content-type-{typeId}", "content-types-{siteId}"],
1510
+ auth: "user",
1511
+ responseKind: "json"
1512
+ },
1513
+ // Admin site creation
1514
+ adminCreateSite: {
1515
+ path: "/admin/sites",
1516
+ method: "POST",
1517
+ tags: ["admin", "sites"],
1518
+ auth: "admin",
1519
+ responseKind: "json"
1520
+ },
1521
+ // SDK Config
1522
+ refreshSdkConfig: {
1523
+ path: "/sites/{siteId}/refresh-sdk-config",
1524
+ method: "POST",
1525
+ tags: ["site-{siteId}", "sdk-config"],
1526
+ auth: "user",
1527
+ responseKind: "json"
1528
+ },
1529
+ // Stripe Connect - Site billing
1530
+ stripeConnectAuthorize: {
1531
+ path: "/sites/{siteId}/billing/connect/authorize",
1532
+ method: "POST",
1533
+ tags: ["site-{siteId}", "stripe-connect"],
1534
+ auth: "user",
1535
+ responseKind: "json"
1536
+ },
1537
+ stripeConnectStatus: {
1538
+ path: "/sites/{siteId}/billing/connect/status",
1539
+ method: "GET",
1540
+ tags: ["site-{siteId}", "stripe-connect"],
1541
+ auth: "user",
1542
+ responseKind: "json"
1543
+ },
1544
+ stripeConnectDisconnect: {
1545
+ path: "/sites/{siteId}/billing/connect/disconnect",
1546
+ method: "DELETE",
1547
+ tags: ["site-{siteId}", "stripe-connect"],
1548
+ auth: "user",
1549
+ responseKind: "json"
1550
+ },
1551
+ // Backup
1552
+ importSiteBackup: {
1553
+ path: "/sites/{siteId}/backup/import",
1554
+ method: "POST",
1555
+ tags: ["site-{siteId}", "backup"],
1556
+ auth: "user",
1557
+ responseKind: "json"
1558
+ },
1559
+ // Admin billing price overrides
1560
+ adminGetPriceOverride: {
1561
+ path: "/admin/billing/price-override",
1562
+ method: "GET",
1563
+ tags: ["admin", "billing", "price-override"],
1564
+ auth: "admin",
1565
+ responseKind: "json"
1566
+ },
1567
+ adminUpsertPriceOverride: {
1568
+ path: "/admin/billing/price-override",
1569
+ method: "POST",
1570
+ tags: ["admin", "billing", "price-override"],
1571
+ auth: "admin",
1572
+ responseKind: "json"
1573
+ },
1574
+ adminDeletePriceOverride: {
1575
+ path: "/admin/billing/price-override",
1576
+ method: "DELETE",
1577
+ tags: ["admin", "billing", "price-override"],
1578
+ auth: "admin",
1579
+ responseKind: "json"
1580
+ }
1581
+ };
1582
+ var API_ENDPOINTS = ENDPOINT_DEFINITIONS;
1583
+ function buildEndpointURL(baseURL, endpoint) {
1584
+ return baseURL + API_ENDPOINTS[endpoint].path;
1585
+ }
1586
+
1587
+ // ../api/src/url.ts
1588
+ function getCmsApiUrl() {
1589
+ const internalUrl = process.env.CMS_API_URL;
1590
+ if (internalUrl) {
1591
+ return internalUrl.replace(/\/$/, "");
1592
+ }
1593
+ const dashboardUrl = process.env.NEXT_PUBLIC_DASHBOARD_URL;
1594
+ if (dashboardUrl) {
1595
+ const base = dashboardUrl.replace(/\/$/, "");
1596
+ return `${base}/api`;
1597
+ }
1598
+ const legacyApiUrl = process.env.NEXT_PUBLIC_CMS_API_URL;
1599
+ if (legacyApiUrl) {
1600
+ return legacyApiUrl.replace(/\/$/, "");
1601
+ }
1602
+ throw new Error(
1603
+ "NEXT_PUBLIC_DASHBOARD_URL is not configured. Set it to your dashboard URL (e.g., http://dashboard.local:4000)"
1604
+ );
1605
+ }
1606
+ function resolveApiBaseUrl() {
1607
+ return getCmsApiUrl();
1608
+ }
1609
+
1610
+ // ../api/src/request.ts
1611
+ var revalidateTag = null;
1612
+ if (typeof window === "undefined") {
1613
+ try {
1614
+ const nextCache = __require("next/cache");
1615
+ revalidateTag = nextCache.revalidateTag;
1616
+ } catch {
1617
+ revalidateTag = null;
1618
+ }
1619
+ }
1620
+ var ApiRequestError = class extends Error {
1621
+ constructor(message, options) {
1622
+ super(message);
1623
+ this.name = "ApiRequestError";
1624
+ this.endpoint = options.endpoint;
1625
+ this.status = options.status;
1626
+ this.method = options.method;
1627
+ this.auth = options.auth;
1628
+ this.requestId = options.requestId;
1629
+ this.body = options.body;
1630
+ this.cause = options.cause;
1631
+ }
1632
+ };
1633
+ function buildEndpointURL2(baseURL, endpoint) {
1634
+ return baseURL + API_ENDPOINTS[endpoint].path;
1635
+ }
1636
+ function invalidateCacheTags(tags, params) {
1637
+ if (typeof window !== "undefined" || !revalidateTag || !tags) return;
1638
+ tags.forEach((tag) => {
1639
+ let processedTag = tag;
1640
+ if (params) {
1641
+ Object.entries(params).forEach(([key, value]) => {
1642
+ processedTag = processedTag.replace(`{${key}}`, String(value));
1643
+ });
1644
+ }
1645
+ try {
1646
+ revalidateTag(processedTag);
1647
+ } catch {
1648
+ }
1649
+ });
1650
+ }
1651
+ async function parseErrorBody(response) {
1652
+ const clone = response.clone();
1653
+ const contentType = clone.headers.get("content-type") ?? "";
1654
+ if (contentType.includes("application/json")) {
1655
+ try {
1656
+ return await clone.json();
1657
+ } catch {
1658
+ }
1659
+ }
1660
+ try {
1661
+ const text = await clone.text();
1662
+ return text.length ? text : null;
1663
+ } catch {
1664
+ return null;
1665
+ }
1666
+ }
1667
+ async function parseSuccessResponse(endpoint, response, config) {
1668
+ const responseKind = config.responseKind ?? "json";
1669
+ const auth = config.auth ?? "user";
1670
+ const requestId = response.headers.get("x-request-id") ?? void 0;
1671
+ switch (responseKind) {
1672
+ case "json": {
1673
+ if (response.status === 204 || response.status === 205 || response.status === 304) {
1674
+ return void 0;
1675
+ }
1676
+ const raw = await response.text();
1677
+ if (!raw.trim()) {
1678
+ return void 0;
1679
+ }
1680
+ try {
1681
+ return JSON.parse(raw);
1682
+ } catch (cause) {
1683
+ throw new ApiRequestError(
1684
+ `Failed to parse JSON response for endpoint ${String(endpoint)}`,
1685
+ {
1686
+ endpoint,
1687
+ status: response.status,
1688
+ method: config.method,
1689
+ auth,
1690
+ requestId,
1691
+ body: raw,
1692
+ cause
1693
+ }
1694
+ );
1695
+ }
1696
+ }
1697
+ case "text": {
1698
+ return await response.text();
1699
+ }
1700
+ case "stream": {
1701
+ const body = response.body;
1702
+ if (!body) {
1703
+ throw new ApiRequestError(
1704
+ `Expected a streamed body for endpoint ${String(endpoint)}`,
1705
+ {
1706
+ endpoint,
1707
+ status: response.status,
1708
+ method: config.method,
1709
+ auth,
1710
+ requestId
1711
+ }
1712
+ );
1713
+ }
1714
+ const stream = body;
1715
+ return stream;
1716
+ }
1717
+ case "void": {
1718
+ return void 0;
1719
+ }
1720
+ default: {
1721
+ return void 0;
1722
+ }
1723
+ }
1724
+ }
1725
+ function createRawCMSClient(headers = {}, baseUrl) {
1726
+ return ({
1727
+ endpoint,
1728
+ body,
1729
+ params,
1730
+ options = {}
1731
+ }) => {
1732
+ const resolvedBaseUrl = baseUrl ?? resolveApiBaseUrl();
1733
+ let url = buildEndpointURL2(resolvedBaseUrl, endpoint);
1734
+ const originalPath = API_ENDPOINTS[endpoint].path;
1735
+ const unusedParams = {};
1736
+ if (params) {
1737
+ Object.entries(params).forEach(([key, value]) => {
1738
+ const placeholder = `{${key}}`;
1739
+ if (originalPath.includes(placeholder)) {
1740
+ url = url.replace(placeholder, value);
1741
+ } else {
1742
+ unusedParams[key] = value;
1743
+ }
1744
+ });
1745
+ }
1746
+ const endpointConfig = API_ENDPOINTS[endpoint];
1747
+ const method = endpointConfig.method;
1748
+ const isGetOrHead = method === "GET" || method === "HEAD";
1749
+ if (isGetOrHead) {
1750
+ const queryParams = new URLSearchParams();
1751
+ Object.entries(unusedParams).forEach(([key, value]) => {
1752
+ if (value !== void 0 && value !== null) {
1753
+ queryParams.append(key, String(value));
1754
+ }
1755
+ });
1756
+ if (body) {
1757
+ Object.entries(body).forEach(([key, value]) => {
1758
+ if (value !== void 0 && value !== null) {
1759
+ queryParams.append(key, String(value));
1760
+ }
1761
+ });
1762
+ }
1763
+ const queryString = queryParams.toString();
1764
+ if (queryString) {
1765
+ url += (url.includes("?") ? "&" : "?") + queryString;
1766
+ }
1767
+ }
1768
+ const isFormData = typeof FormData !== "undefined" && body instanceof FormData;
1769
+ const nextOptions = {};
1770
+ if (isGetOrHead && "revalidate" in endpointConfig && typeof endpointConfig.revalidate === "number") {
1771
+ nextOptions.revalidate = endpointConfig.revalidate;
1772
+ }
1773
+ if ("tags" in endpointConfig && Array.isArray(endpointConfig.tags)) {
1774
+ nextOptions.tags = endpointConfig.tags.map((tag) => {
1775
+ let processedTag = tag;
1776
+ if (params) {
1777
+ Object.entries(params).forEach(([key, value]) => {
1778
+ processedTag = processedTag.replace(`{${key}}`, String(value));
1779
+ });
1780
+ }
1781
+ return processedTag;
1782
+ });
1783
+ }
1784
+ const requestInit = {
1785
+ method,
1786
+ ...options,
1787
+ // Don't include body for GET/HEAD requests
1788
+ body: isGetOrHead ? void 0 : isFormData ? body : body ? JSON.stringify(body) : void 0,
1789
+ headers: {
1790
+ ...options.headers,
1791
+ ...headers,
1792
+ // Don't set Content-Type for GET/HEAD requests without body
1793
+ ...isGetOrHead ? {} : isFormData ? {} : { "Content-Type": "application/json" }
1794
+ },
1795
+ // Add Next.js caching options
1796
+ next: Object.keys(nextOptions).length > 0 ? nextOptions : void 0
1797
+ };
1798
+ const fetchPromise = fetch(url, requestInit);
1799
+ if (!isGetOrHead && "tags" in endpointConfig && Array.isArray(endpointConfig.tags)) {
1800
+ const tags = endpointConfig.tags.map((tag) => tag);
1801
+ return fetchPromise.then((response) => {
1802
+ if (response.ok) {
1803
+ invalidateCacheTags(tags, params);
1804
+ }
1805
+ return response;
1806
+ });
1807
+ }
1808
+ return fetchPromise;
1809
+ };
1810
+ }
1811
+ function createParsedClient(rawClient) {
1812
+ return async (params) => {
1813
+ const response = await rawClient(params);
1814
+ const endpoint = params.endpoint;
1815
+ const config = API_ENDPOINTS[endpoint];
1816
+ const auth = config.auth ?? "user";
1817
+ if (!response.ok) {
1818
+ const body = await parseErrorBody(response);
1819
+ const requestId = response.headers.get("x-request-id") ?? void 0;
1820
+ throw new ApiRequestError(
1821
+ `Request to ${String(endpoint)} failed with status ${response.status}`,
1822
+ {
1823
+ endpoint,
1824
+ status: response.status,
1825
+ method: config.method,
1826
+ auth,
1827
+ requestId,
1828
+ body
1829
+ }
1830
+ );
1831
+ }
1832
+ return parseSuccessResponse(endpoint, response, config);
1833
+ };
1834
+ }
1835
+ function createCMSClient(headers = {}, baseUrl) {
1836
+ return createParsedClient(createRawCMSClient(headers, baseUrl));
1837
+ }
1838
+ function createBearerAPIClient(token, baseUrl) {
1839
+ const authHeaders = {
1840
+ Authorization: `Bearer ${token}`
1841
+ };
1842
+ return createCMSClient(authHeaders, baseUrl);
1843
+ }
1844
+
1845
+ // ../api/src/aiPlayground.ts
1846
+ import { z } from "zod";
1847
+ var Rfc6902PatchOp = z.discriminatedUnion("op", [
1848
+ // Standard RFC-6902 operations
1849
+ z.object({
1850
+ op: z.literal("add"),
1851
+ path: z.string(),
1852
+ value: z.unknown()
1853
+ }),
1854
+ z.object({
1855
+ op: z.literal("remove"),
1856
+ path: z.string()
1857
+ }),
1858
+ z.object({
1859
+ op: z.literal("replace"),
1860
+ path: z.string(),
1861
+ value: z.unknown()
1862
+ }),
1863
+ z.object({
1864
+ op: z.literal("move"),
1865
+ from: z.string(),
1866
+ path: z.string()
1867
+ }),
1868
+ z.object({
1869
+ op: z.literal("copy"),
1870
+ from: z.string(),
1871
+ path: z.string()
1872
+ }),
1873
+ // Block-level operations (Phase 2)
1874
+ z.object({
1875
+ op: z.literal("add_block"),
1876
+ blockKind: z.string(),
1877
+ afterBlockId: z.string().nullable(),
1878
+ content: z.record(z.string(), z.unknown()),
1879
+ rationale: z.string()
1880
+ }),
1881
+ z.object({
1882
+ op: z.literal("delete_block"),
1883
+ blockId: z.string(),
1884
+ rationale: z.string()
1885
+ }),
1886
+ z.object({
1887
+ op: z.literal("reorder_block"),
1888
+ blockId: z.string(),
1889
+ afterBlockId: z.string().nullable(),
1890
+ rationale: z.string()
1891
+ })
1892
+ ]);
1893
+ var PatchEnvelope = z.object({
1894
+ blockId: z.string(),
1895
+ blockKind: z.string().optional(),
1896
+ blockPurpose: z.string().optional().nullable(),
1897
+ ops: z.array(Rfc6902PatchOp),
1898
+ rationale: z.string(),
1899
+ currentContent: z.record(z.string(), z.unknown()).optional()
1900
+ });
1901
+ var ContentUpdateResponse = z.object({
1902
+ patches: z.array(PatchEnvelope),
1903
+ assistantMessage: z.string()
1904
+ });
1905
+ var PlaygroundProposeRequest = z.object({
1906
+ request: z.string().min(1).max(2e3)
1907
+ });
1908
+ var PlaygroundProposeResponse = z.object({
1909
+ patches: z.array(PatchEnvelope),
1910
+ assistantMessage: z.string(),
1911
+ validation: z.object({
1912
+ valid: z.boolean(),
1913
+ issues: z.array(z.string()),
1914
+ filtered: z.number()
1915
+ })
1916
+ });
1917
+ var MultiPagePatchEnvelope = z.object({
1918
+ pageId: z.string(),
1919
+ blockId: z.string().optional(),
1920
+ // Not present for page-level ops
1921
+ blockKind: z.string().optional(),
1922
+ blockPurpose: z.string().optional().nullable(),
1923
+ ops: z.array(Rfc6902PatchOp),
1924
+ rationale: z.string(),
1925
+ currentContent: z.record(z.string(), z.unknown()).optional()
1926
+ });
1927
+ var MultiPageUpdateResponse = z.object({
1928
+ patches: z.array(MultiPagePatchEnvelope),
1929
+ assistantMessage: z.string(),
1930
+ pagesModified: z.number(),
1931
+ toolCallsUsed: z.number()
1932
+ });
1933
+
1934
+ // src/client/cache.ts
1935
+ var SimpleCache = class {
1936
+ constructor(options = {}) {
1937
+ this.cache = /* @__PURE__ */ new Map();
1938
+ this.maxSize = options.maxSize ?? 100;
1939
+ this.ttl = options.ttl ?? 3e5;
1940
+ }
1941
+ get(key) {
1942
+ const entry = this.cache.get(key);
1943
+ if (!entry) return void 0;
1944
+ if (Date.now() > entry.expires) {
1945
+ this.cache.delete(key);
1946
+ return void 0;
1947
+ }
1948
+ return entry.value;
1949
+ }
1950
+ set(key, value) {
1951
+ if (this.cache.size >= this.maxSize) {
1952
+ const firstKey = this.cache.keys().next().value;
1953
+ if (firstKey) {
1954
+ this.cache.delete(firstKey);
1955
+ }
1956
+ }
1957
+ this.cache.set(key, {
1958
+ value,
1959
+ expires: Date.now() + this.ttl
1960
+ });
1961
+ }
1962
+ clear() {
1963
+ this.cache.clear();
1964
+ }
1965
+ has(key) {
1966
+ return this.get(key) !== void 0;
1967
+ }
1968
+ };
1969
+
1970
+ // src/client/index.ts
1971
+ function createRiverbankClient(config) {
1972
+ if (!config.baseUrl) {
1973
+ throw new Error(
1974
+ "baseUrl is required when creating a Builder client. Expected format: https://dashboard.example.com/api (must include /api path)"
1975
+ );
1976
+ }
1977
+ if (!config.baseUrl.endsWith("/api")) {
1978
+ throw new Error(
1979
+ `baseUrl must end with '/api'. Received: ${config.baseUrl}. Expected format: https://dashboard.example.com/api`
1980
+ );
1981
+ }
1982
+ const cacheEnabled = config.cache?.enabled ?? true;
1983
+ const cacheTTL = (config.cache?.ttl ?? 300) * 1e3;
1984
+ const cacheMaxSize = config.cache?.maxSize ?? 100;
1985
+ const apiClient = createBearerAPIClient(config.apiKey, config.baseUrl);
1986
+ const cache = new SimpleCache({
1987
+ maxSize: cacheMaxSize,
1988
+ ttl: cacheTTL
1989
+ });
1990
+ async function cachedFetch(cacheKey, fetcher, options) {
1991
+ if (cacheEnabled && !options?.force) {
1992
+ const cached = cache.get(cacheKey);
1993
+ if (cached !== void 0) {
1994
+ return cached;
1995
+ }
1996
+ }
1997
+ const data = await fetcher();
1998
+ if (cacheEnabled) {
1999
+ cache.set(cacheKey, data);
2000
+ }
2001
+ return data;
2002
+ }
2003
+ return {
2004
+ async getSite(params) {
2005
+ const { slug, domain, id } = params;
2006
+ if (!slug && !domain && !id) {
2007
+ throw new Error(
2008
+ `getSite() requires at least one identifier: slug, domain, or id. Received: ${JSON.stringify(params)}`
2009
+ );
2010
+ }
2011
+ const cacheKey = `site:${slug || domain || id}`;
2012
+ return cachedFetch(cacheKey, async () => {
2013
+ const apiParams = {};
2014
+ if (params.slug) apiParams.slug = params.slug;
2015
+ if (params.domain) apiParams.domain = params.domain;
2016
+ if (params.id) apiParams.id = params.id;
2017
+ return await apiClient({ endpoint: "getSite", params: apiParams });
2018
+ });
2019
+ },
2020
+ async getPage(params) {
2021
+ const { siteId, path, preview = false } = params;
2022
+ const cacheKey = `page:${siteId}:${path}:${preview}`;
2023
+ return cachedFetch(cacheKey, async () => {
2024
+ return await apiClient({ endpoint: "getContentByPath", params: { siteId }, body: { path, preview } });
2025
+ });
2026
+ },
2027
+ async getEntries(params) {
2028
+ const { siteId, contentType, limit, order, preview = false, mode, entryIds } = params;
2029
+ const entryIdsCacheKey = mode === "manual" && entryIds?.length ? entryIds.join(",") : "";
2030
+ const cacheKey = `entries:${siteId}:${contentType}:${limit ?? ""}:${order ?? ""}:${preview}:${mode ?? ""}:${entryIdsCacheKey}`;
2031
+ return cachedFetch(cacheKey, async () => {
2032
+ const apiParams = {
2033
+ siteId,
2034
+ type: contentType
2035
+ };
2036
+ if (typeof limit === "number") {
2037
+ apiParams.limit = String(limit);
2038
+ }
2039
+ if (order === "newest") {
2040
+ apiParams.order = "published_at.desc";
2041
+ } else if (order === "oldest") {
2042
+ apiParams.order = "published_at.asc";
2043
+ } else if (order === "title") {
2044
+ apiParams.order = "title.asc";
2045
+ }
2046
+ if (preview) {
2047
+ apiParams.stage = "preview";
2048
+ }
2049
+ if (mode === "manual" && entryIds?.length) {
2050
+ apiParams.mode = "manual";
2051
+ apiParams.entryIds = JSON.stringify(entryIds);
2052
+ }
2053
+ return await apiClient({ endpoint: "listPublishedEntries", params: apiParams });
2054
+ });
2055
+ },
2056
+ async getEntry(params) {
2057
+ const { siteId, contentType, slug } = params;
2058
+ const cacheKey = `entry:${siteId}:${contentType}:${slug}`;
2059
+ return cachedFetch(cacheKey, async () => {
2060
+ return await apiClient({ endpoint: "getPublishedEntryPreview", params: { siteId, type: contentType, slug } });
2061
+ });
2062
+ },
2063
+ async getPublicFormById(params) {
2064
+ const { formId } = params;
2065
+ if (!formId) {
2066
+ throw new Error("getPublicFormById() requires formId");
2067
+ }
2068
+ const cacheKey = `public-form:${formId}`;
2069
+ return cachedFetch(cacheKey, async () => {
2070
+ return await apiClient({ endpoint: "getPublicFormById", params: { formId } });
2071
+ });
2072
+ },
2073
+ async getPublicBookingServices(params) {
2074
+ const { siteId, ids } = params;
2075
+ if (!siteId) {
2076
+ throw new Error("getPublicBookingServices() requires siteId");
2077
+ }
2078
+ const cacheKey = `public-booking-services:${siteId}:${ids ?? ""}`;
2079
+ return cachedFetch(cacheKey, async () => {
2080
+ const apiParams = { siteId };
2081
+ if (ids) apiParams.ids = ids;
2082
+ return await apiClient({ endpoint: "getPublicBookingServices", params: apiParams });
2083
+ });
2084
+ },
2085
+ async listPublicEvents(params) {
2086
+ const { siteId, limit, from, to, stage } = params;
2087
+ if (!siteId) {
2088
+ throw new Error("listPublicEvents() requires siteId");
2089
+ }
2090
+ const cacheKey = `public-events:${siteId}:${limit ?? ""}:${from ?? ""}:${to ?? ""}:${stage ?? ""}`;
2091
+ return cachedFetch(cacheKey, async () => {
2092
+ const apiParams = { siteId };
2093
+ if (typeof limit === "number") apiParams.limit = String(limit);
2094
+ if (from) apiParams.from = from;
2095
+ if (to) apiParams.to = to;
2096
+ if (stage) apiParams.stage = stage;
2097
+ return await apiClient({ endpoint: "listPublicEvents", params: apiParams });
2098
+ });
2099
+ },
2100
+ clearCache() {
2101
+ cache.clear();
2102
+ }
2103
+ };
2104
+ }
2105
+
2106
+ export {
2107
+ API_ENDPOINTS,
2108
+ buildEndpointURL,
2109
+ createRiverbankClient
2110
+ };
2111
+ //# sourceMappingURL=chunk-3J46ILMJ.mjs.map