@decocms/blocks 8.1.0-next.0 → 8.1.0-next.2

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 (490) hide show
  1. package/bin/deco.js +5 -12
  2. package/dist/index.d.ts +2 -0
  3. package/dist/index.d.ts.map +1 -0
  4. package/dist/index.js +4 -0
  5. package/dist/index.js.map +1 -0
  6. package/dist/protocol/assets.d.ts +46 -0
  7. package/dist/protocol/assets.d.ts.map +1 -0
  8. package/dist/protocol/assets.js +105 -0
  9. package/dist/protocol/assets.js.map +1 -0
  10. package/dist/protocol/canonical.d.ts +8 -0
  11. package/dist/protocol/canonical.d.ts.map +1 -0
  12. package/dist/protocol/canonical.js +8 -0
  13. package/dist/protocol/canonical.js.map +1 -0
  14. package/dist/protocol/ciphertext.d.ts +7 -0
  15. package/dist/protocol/ciphertext.d.ts.map +1 -0
  16. package/dist/protocol/ciphertext.js +7 -0
  17. package/dist/protocol/ciphertext.js.map +1 -0
  18. package/dist/protocol/client.d.ts +54 -0
  19. package/dist/protocol/client.d.ts.map +1 -0
  20. package/dist/protocol/client.js +104 -0
  21. package/dist/protocol/client.js.map +1 -0
  22. package/dist/protocol/conformance/cases/assets.d.ts +3 -0
  23. package/dist/protocol/conformance/cases/assets.d.ts.map +1 -0
  24. package/dist/protocol/conformance/cases/assets.js +71 -0
  25. package/dist/protocol/conformance/cases/assets.js.map +1 -0
  26. package/dist/protocol/conformance/cases/guards.d.ts +3 -0
  27. package/dist/protocol/conformance/cases/guards.d.ts.map +1 -0
  28. package/dist/protocol/conformance/cases/guards.js +265 -0
  29. package/dist/protocol/conformance/cases/guards.js.map +1 -0
  30. package/dist/protocol/conformance/cases/reads.d.ts +3 -0
  31. package/dist/protocol/conformance/cases/reads.d.ts.map +1 -0
  32. package/dist/protocol/conformance/cases/reads.js +140 -0
  33. package/dist/protocol/conformance/cases/reads.js.map +1 -0
  34. package/dist/protocol/conformance/cases/types.d.ts +9 -0
  35. package/dist/protocol/conformance/cases/types.d.ts.map +1 -0
  36. package/dist/protocol/conformance/cases/types.js +2 -0
  37. package/dist/protocol/conformance/cases/types.js.map +1 -0
  38. package/dist/protocol/conformance/cases/wire.d.ts +3 -0
  39. package/dist/protocol/conformance/cases/wire.d.ts.map +1 -0
  40. package/dist/protocol/conformance/cases/wire.js +130 -0
  41. package/dist/protocol/conformance/cases/wire.js.map +1 -0
  42. package/dist/protocol/conformance/cases/writes.d.ts +3 -0
  43. package/dist/protocol/conformance/cases/writes.d.ts.map +1 -0
  44. package/dist/protocol/conformance/cases/writes.js +278 -0
  45. package/dist/protocol/conformance/cases/writes.js.map +1 -0
  46. package/dist/protocol/conformance/contentHashFixtures.d.ts +22 -0
  47. package/dist/protocol/conformance/contentHashFixtures.d.ts.map +1 -0
  48. package/dist/protocol/conformance/contentHashFixtures.js +64 -0
  49. package/dist/protocol/conformance/contentHashFixtures.js.map +1 -0
  50. package/dist/protocol/conformance/context.d.ts +100 -0
  51. package/dist/protocol/conformance/context.d.ts.map +1 -0
  52. package/dist/protocol/conformance/context.js +155 -0
  53. package/dist/protocol/conformance/context.js.map +1 -0
  54. package/dist/protocol/conformance/index.d.ts +32 -0
  55. package/dist/protocol/conformance/index.d.ts.map +1 -0
  56. package/dist/protocol/conformance/index.js +90 -0
  57. package/dist/protocol/conformance/index.js.map +1 -0
  58. package/dist/protocol/errors.d.ts +85 -0
  59. package/dist/protocol/errors.d.ts.map +1 -0
  60. package/dist/protocol/errors.js +62 -0
  61. package/dist/protocol/errors.js.map +1 -0
  62. package/dist/protocol/index.d.ts +25 -0
  63. package/dist/protocol/index.d.ts.map +1 -0
  64. package/dist/protocol/index.js +25 -0
  65. package/dist/protocol/index.js.map +1 -0
  66. package/dist/protocol/keys.d.ts +101 -0
  67. package/dist/protocol/keys.d.ts.map +1 -0
  68. package/dist/protocol/keys.js +223 -0
  69. package/dist/protocol/keys.js.map +1 -0
  70. package/dist/protocol/params.d.ts +10 -0
  71. package/dist/protocol/params.d.ts.map +1 -0
  72. package/dist/protocol/params.js +54 -0
  73. package/dist/protocol/params.js.map +1 -0
  74. package/dist/protocol/secrets.d.ts +22 -0
  75. package/dist/protocol/secrets.d.ts.map +1 -0
  76. package/dist/protocol/secrets.js +200 -0
  77. package/dist/protocol/secrets.js.map +1 -0
  78. package/dist/protocol/server/assets.d.ts +20 -0
  79. package/dist/protocol/server/assets.d.ts.map +1 -0
  80. package/dist/protocol/server/assets.js +77 -0
  81. package/dist/protocol/server/assets.js.map +1 -0
  82. package/dist/protocol/server/auth.d.ts +31 -0
  83. package/dist/protocol/server/auth.d.ts.map +1 -0
  84. package/dist/protocol/server/auth.js +32 -0
  85. package/dist/protocol/server/auth.js.map +1 -0
  86. package/dist/protocol/server/bodyCache.d.ts +28 -0
  87. package/dist/protocol/server/bodyCache.d.ts.map +1 -0
  88. package/dist/protocol/server/bodyCache.js +75 -0
  89. package/dist/protocol/server/bodyCache.js.map +1 -0
  90. package/dist/protocol/server/content.d.ts +44 -0
  91. package/dist/protocol/server/content.d.ts.map +1 -0
  92. package/dist/protocol/server/content.js +132 -0
  93. package/dist/protocol/server/content.js.map +1 -0
  94. package/dist/protocol/server/core.d.ts +63 -0
  95. package/dist/protocol/server/core.d.ts.map +1 -0
  96. package/dist/protocol/server/core.js +77 -0
  97. package/dist/protocol/server/core.js.map +1 -0
  98. package/dist/protocol/server/handler.d.ts +5 -0
  99. package/dist/protocol/server/handler.d.ts.map +1 -0
  100. package/dist/protocol/server/handler.js +70 -0
  101. package/dist/protocol/server/handler.js.map +1 -0
  102. package/dist/protocol/server/http.d.ts +24 -0
  103. package/dist/protocol/server/http.d.ts.map +1 -0
  104. package/dist/protocol/server/http.js +133 -0
  105. package/dist/protocol/server/http.js.map +1 -0
  106. package/dist/protocol/server/index.d.ts +11 -0
  107. package/dist/protocol/server/index.d.ts.map +1 -0
  108. package/dist/protocol/server/index.js +9 -0
  109. package/dist/protocol/server/index.js.map +1 -0
  110. package/dist/protocol/server/methods/apply.d.ts +4 -0
  111. package/dist/protocol/server/methods/apply.d.ts.map +1 -0
  112. package/dist/protocol/server/methods/apply.js +275 -0
  113. package/dist/protocol/server/methods/apply.js.map +1 -0
  114. package/dist/protocol/server/methods/read.d.ts +14 -0
  115. package/dist/protocol/server/methods/read.d.ts.map +1 -0
  116. package/dist/protocol/server/methods/read.js +132 -0
  117. package/dist/protocol/server/methods/read.js.map +1 -0
  118. package/dist/protocol/server/rpc.d.ts +7 -0
  119. package/dist/protocol/server/rpc.d.ts.map +1 -0
  120. package/dist/protocol/server/rpc.js +115 -0
  121. package/dist/protocol/server/rpc.js.map +1 -0
  122. package/dist/protocol/storage/fs/hash.d.ts +8 -0
  123. package/dist/protocol/storage/fs/hash.d.ts.map +1 -0
  124. package/dist/protocol/storage/fs/hash.js +20 -0
  125. package/dist/protocol/storage/fs/hash.js.map +1 -0
  126. package/dist/protocol/storage/fs/index.d.ts +30 -0
  127. package/dist/protocol/storage/fs/index.d.ts.map +1 -0
  128. package/dist/protocol/storage/fs/index.js +301 -0
  129. package/dist/protocol/storage/fs/index.js.map +1 -0
  130. package/dist/protocol/storage/fs/lock.d.ts +8 -0
  131. package/dist/protocol/storage/fs/lock.d.ts.map +1 -0
  132. package/dist/protocol/storage/fs/lock.js +61 -0
  133. package/dist/protocol/storage/fs/lock.js.map +1 -0
  134. package/dist/protocol/storage/fs/transaction.d.ts +19 -0
  135. package/dist/protocol/storage/fs/transaction.d.ts.map +1 -0
  136. package/dist/protocol/storage/fs/transaction.js +174 -0
  137. package/dist/protocol/storage/fs/transaction.js.map +1 -0
  138. package/dist/protocol/storage/fs/unsupported.d.ts +10 -0
  139. package/dist/protocol/storage/fs/unsupported.d.ts.map +1 -0
  140. package/dist/protocol/storage/fs/unsupported.js +4 -0
  141. package/dist/protocol/storage/fs/unsupported.js.map +1 -0
  142. package/dist/protocol/storage/memory.d.ts +40 -0
  143. package/dist/protocol/storage/memory.d.ts.map +1 -0
  144. package/dist/protocol/storage/memory.js +179 -0
  145. package/dist/protocol/storage/memory.js.map +1 -0
  146. package/dist/protocol/storage.d.ts +178 -0
  147. package/dist/protocol/storage.d.ts.map +1 -0
  148. package/dist/protocol/storage.js +29 -0
  149. package/dist/protocol/storage.js.map +1 -0
  150. package/dist/protocol/types.d.ts +194 -0
  151. package/dist/protocol/types.d.ts.map +1 -0
  152. package/dist/protocol/types.js +31 -0
  153. package/dist/protocol/types.js.map +1 -0
  154. package/dist/v8/analytics.d.ts +31 -0
  155. package/dist/v8/analytics.d.ts.map +1 -0
  156. package/dist/v8/analytics.js +46 -0
  157. package/dist/v8/analytics.js.map +1 -0
  158. package/dist/v8/background.d.ts +26 -0
  159. package/dist/v8/background.d.ts.map +1 -0
  160. package/dist/v8/background.js +95 -0
  161. package/dist/v8/background.js.map +1 -0
  162. package/dist/v8/builtins/data.d.ts +15 -0
  163. package/dist/v8/builtins/data.d.ts.map +1 -0
  164. package/dist/v8/builtins/data.js +18 -0
  165. package/dist/v8/builtins/data.js.map +1 -0
  166. package/dist/v8/builtins/index.d.ts +9 -0
  167. package/dist/v8/builtins/index.d.ts.map +1 -0
  168. package/dist/v8/builtins/index.js +24 -0
  169. package/dist/v8/builtins/index.js.map +1 -0
  170. package/dist/v8/builtins/lazy.d.ts +17 -0
  171. package/dist/v8/builtins/lazy.d.ts.map +1 -0
  172. package/dist/v8/builtins/lazy.js +13 -0
  173. package/dist/v8/builtins/lazy.js.map +1 -0
  174. package/dist/v8/builtins/legacy.d.ts +41 -0
  175. package/dist/v8/builtins/legacy.d.ts.map +1 -0
  176. package/dist/v8/builtins/legacy.js +62 -0
  177. package/dist/v8/builtins/legacy.js.map +1 -0
  178. package/dist/v8/builtins/matchers.d.ts +19 -0
  179. package/dist/v8/builtins/matchers.d.ts.map +1 -0
  180. package/dist/v8/builtins/matchers.js +24 -0
  181. package/dist/v8/builtins/matchers.js.map +1 -0
  182. package/dist/v8/builtins/multivariate.d.ts +15 -0
  183. package/dist/v8/builtins/multivariate.d.ts.map +1 -0
  184. package/dist/v8/builtins/multivariate.js +18 -0
  185. package/dist/v8/builtins/multivariate.js.map +1 -0
  186. package/dist/v8/builtins/secret.d.ts +7 -0
  187. package/dist/v8/builtins/secret.d.ts.map +1 -0
  188. package/dist/v8/builtins/secret.js +68 -0
  189. package/dist/v8/builtins/secret.js.map +1 -0
  190. package/dist/v8/canonical.d.ts +42 -0
  191. package/dist/v8/canonical.d.ts.map +1 -0
  192. package/dist/v8/canonical.js +111 -0
  193. package/dist/v8/canonical.js.map +1 -0
  194. package/dist/v8/ciphertext.d.ts +58 -0
  195. package/dist/v8/ciphertext.d.ts.map +1 -0
  196. package/dist/v8/ciphertext.js +134 -0
  197. package/dist/v8/ciphertext.js.map +1 -0
  198. package/dist/v8/cli/builtins.d.ts +11 -0
  199. package/dist/v8/cli/builtins.d.ts.map +1 -0
  200. package/dist/v8/cli/builtins.js +18 -0
  201. package/dist/v8/cli/builtins.js.map +1 -0
  202. package/dist/v8/cli/check/index.d.ts +41 -0
  203. package/dist/v8/cli/check/index.d.ts.map +1 -0
  204. package/dist/v8/cli/check/index.js +713 -0
  205. package/dist/v8/cli/check/index.js.map +1 -0
  206. package/dist/v8/cli/check/messages.d.ts +24 -0
  207. package/dist/v8/cli/check/messages.d.ts.map +1 -0
  208. package/dist/v8/cli/check/messages.js +150 -0
  209. package/dist/v8/cli/check/messages.js.map +1 -0
  210. package/dist/v8/cli/content.d.ts +60 -0
  211. package/dist/v8/cli/content.d.ts.map +1 -0
  212. package/dist/v8/cli/content.js +231 -0
  213. package/dist/v8/cli/content.js.map +1 -0
  214. package/dist/v8/cli/index.d.ts +18 -0
  215. package/dist/v8/cli/index.d.ts.map +1 -0
  216. package/dist/v8/cli/index.js +18 -0
  217. package/dist/v8/cli/index.js.map +1 -0
  218. package/dist/v8/cli/log.d.ts +9 -0
  219. package/dist/v8/cli/log.d.ts.map +1 -0
  220. package/dist/v8/cli/log.js +11 -0
  221. package/dist/v8/cli/log.js.map +1 -0
  222. package/dist/v8/cli/main.d.ts +2 -0
  223. package/dist/v8/cli/main.d.ts.map +1 -0
  224. package/dist/v8/cli/main.js +9 -0
  225. package/dist/v8/cli/main.js.map +1 -0
  226. package/dist/v8/cli/root.d.ts +28 -0
  227. package/dist/v8/cli/root.d.ts.map +1 -0
  228. package/dist/v8/cli/root.js +64 -0
  229. package/dist/v8/cli/root.js.map +1 -0
  230. package/dist/v8/cli/run.d.ts +13 -0
  231. package/dist/v8/cli/run.d.ts.map +1 -0
  232. package/dist/v8/cli/run.js +210 -0
  233. package/dist/v8/cli/run.js.map +1 -0
  234. package/dist/v8/cli/schema/builtinSchemas.d.ts +22 -0
  235. package/dist/v8/cli/schema/builtinSchemas.d.ts.map +1 -0
  236. package/dist/v8/cli/schema/builtinSchemas.js +213 -0
  237. package/dist/v8/cli/schema/builtinSchemas.js.map +1 -0
  238. package/dist/v8/cli/schema/generate.d.ts +50 -0
  239. package/dist/v8/cli/schema/generate.d.ts.map +1 -0
  240. package/dist/v8/cli/schema/generate.js +415 -0
  241. package/dist/v8/cli/schema/generate.js.map +1 -0
  242. package/dist/v8/cli/schema/index.d.ts +21 -0
  243. package/dist/v8/cli/schema/index.d.ts.map +1 -0
  244. package/dist/v8/cli/schema/index.js +51 -0
  245. package/dist/v8/cli/schema/index.js.map +1 -0
  246. package/dist/v8/cli/schema/tsProgram.d.ts +120 -0
  247. package/dist/v8/cli/schema/tsProgram.d.ts.map +1 -0
  248. package/dist/v8/cli/schema/tsProgram.js +418 -0
  249. package/dist/v8/cli/schema/tsProgram.js.map +1 -0
  250. package/dist/v8/cli/schema/typeToSchema.d.ts +81 -0
  251. package/dist/v8/cli/schema/typeToSchema.d.ts.map +1 -0
  252. package/dist/v8/cli/schema/typeToSchema.js +683 -0
  253. package/dist/v8/cli/schema/typeToSchema.js.map +1 -0
  254. package/dist/v8/cli/serve/server.d.ts +31 -0
  255. package/dist/v8/cli/serve/server.d.ts.map +1 -0
  256. package/dist/v8/cli/serve/server.js +247 -0
  257. package/dist/v8/cli/serve/server.js.map +1 -0
  258. package/dist/v8/cli/watch.d.ts +20 -0
  259. package/dist/v8/cli/watch.d.ts.map +1 -0
  260. package/dist/v8/cli/watch.js +79 -0
  261. package/dist/v8/cli/watch.js.map +1 -0
  262. package/dist/v8/client.d.ts +20 -0
  263. package/dist/v8/client.d.ts.map +1 -0
  264. package/dist/v8/client.js +115 -0
  265. package/dist/v8/client.js.map +1 -0
  266. package/dist/v8/cms.d.ts +9 -0
  267. package/dist/v8/cms.d.ts.map +1 -0
  268. package/dist/v8/cms.js +206 -0
  269. package/dist/v8/cms.js.map +1 -0
  270. package/dist/v8/content.d.ts +35 -0
  271. package/dist/v8/content.d.ts.map +1 -0
  272. package/dist/v8/content.js +183 -0
  273. package/dist/v8/content.js.map +1 -0
  274. package/dist/v8/draft.d.ts +44 -0
  275. package/dist/v8/draft.d.ts.map +1 -0
  276. package/dist/v8/draft.js +133 -0
  277. package/dist/v8/draft.js.map +1 -0
  278. package/dist/v8/errors.d.ts +21 -0
  279. package/dist/v8/errors.d.ts.map +1 -0
  280. package/dist/v8/errors.js +39 -0
  281. package/dist/v8/errors.js.map +1 -0
  282. package/dist/v8/fetch.d.ts +26 -0
  283. package/dist/v8/fetch.d.ts.map +1 -0
  284. package/dist/v8/fetch.js +98 -0
  285. package/dist/v8/fetch.js.map +1 -0
  286. package/dist/v8/identity.d.ts +19 -0
  287. package/dist/v8/identity.d.ts.map +1 -0
  288. package/dist/v8/identity.js +54 -0
  289. package/dist/v8/identity.js.map +1 -0
  290. package/dist/v8/index.d.ts +11 -0
  291. package/dist/v8/index.d.ts.map +1 -0
  292. package/dist/v8/index.js +10 -0
  293. package/dist/v8/index.js.map +1 -0
  294. package/dist/v8/json.d.ts +19 -0
  295. package/dist/v8/json.d.ts.map +1 -0
  296. package/dist/v8/json.js +65 -0
  297. package/dist/v8/json.js.map +1 -0
  298. package/dist/v8/matchRoute.d.ts +30 -0
  299. package/dist/v8/matchRoute.d.ts.map +1 -0
  300. package/dist/v8/matchRoute.js +175 -0
  301. package/dist/v8/matchRoute.js.map +1 -0
  302. package/dist/v8/remoteLoader.d.ts +16 -0
  303. package/dist/v8/remoteLoader.d.ts.map +1 -0
  304. package/dist/v8/remoteLoader.js +243 -0
  305. package/dist/v8/remoteLoader.js.map +1 -0
  306. package/dist/v8/resolver.d.ts +34 -0
  307. package/dist/v8/resolver.d.ts.map +1 -0
  308. package/dist/v8/resolver.js +219 -0
  309. package/dist/v8/resolver.js.map +1 -0
  310. package/dist/v8/secrets.d.ts +9 -0
  311. package/dist/v8/secrets.d.ts.map +1 -0
  312. package/dist/v8/secrets.js +14 -0
  313. package/dist/v8/secrets.js.map +1 -0
  314. package/dist/v8/telemetry.d.ts +61 -0
  315. package/dist/v8/telemetry.d.ts.map +1 -0
  316. package/dist/v8/telemetry.js +460 -0
  317. package/dist/v8/telemetry.js.map +1 -0
  318. package/dist/v8/types.d.ts +214 -0
  319. package/dist/v8/types.d.ts.map +1 -0
  320. package/dist/v8/types.js +2 -0
  321. package/dist/v8/types.js.map +1 -0
  322. package/package.json +65 -105
  323. package/src/index.ts +3 -13
  324. package/src/protocol/canonical.ts +1 -1
  325. package/src/protocol/ciphertext.ts +1 -1
  326. package/src/protocol/client.ts +2 -2
  327. package/src/protocol/conformance/cases/assets.ts +3 -3
  328. package/src/protocol/conformance/cases/guards.ts +4 -4
  329. package/src/protocol/conformance/cases/reads.ts +4 -4
  330. package/src/protocol/conformance/cases/types.ts +1 -1
  331. package/src/protocol/conformance/cases/wire.ts +4 -4
  332. package/src/protocol/conformance/cases/writes.ts +4 -4
  333. package/src/protocol/conformance/context.ts +4 -4
  334. package/src/protocol/conformance/index.ts +10 -10
  335. package/src/protocol/index.ts +6 -6
  336. package/src/protocol/params.ts +2 -2
  337. package/src/protocol/secrets.ts +3 -3
  338. package/src/protocol/server/assets.ts +6 -6
  339. package/src/protocol/server/auth.ts +1 -1
  340. package/src/protocol/server/content.ts +5 -5
  341. package/src/protocol/server/core.ts +12 -6
  342. package/src/protocol/server/handler.ts +6 -6
  343. package/src/protocol/server/http.ts +1 -1
  344. package/src/protocol/server/index.ts +3 -3
  345. package/src/protocol/server/methods/apply.ts +9 -9
  346. package/src/protocol/server/methods/read.ts +5 -5
  347. package/src/protocol/server/rpc.ts +6 -6
  348. package/src/protocol/storage/fs/index.ts +7 -7
  349. package/src/protocol/storage/fs/lock.ts +1 -1
  350. package/src/protocol/storage/fs/unsupported.ts +2 -2
  351. package/src/protocol/storage/memory.ts +5 -5
  352. package/src/protocol/storage.ts +1 -1
  353. package/src/v8/analytics.ts +2 -2
  354. package/src/v8/background.ts +3 -3
  355. package/src/v8/builtins/data.ts +1 -1
  356. package/src/v8/builtins/index.ts +6 -6
  357. package/src/v8/builtins/lazy.ts +1 -1
  358. package/src/v8/builtins/legacy.ts +2 -2
  359. package/src/v8/builtins/multivariate.ts +1 -1
  360. package/src/v8/builtins/secret.ts +2 -2
  361. package/src/v8/cli/builtins.ts +2 -2
  362. package/src/v8/cli/check/index.ts +11 -11
  363. package/src/v8/cli/content.ts +6 -6
  364. package/src/v8/cli/index.ts +8 -8
  365. package/src/v8/cli/main.ts +1 -1
  366. package/src/v8/cli/run.ts +7 -7
  367. package/src/v8/cli/schema/builtinSchemas.ts +1 -1
  368. package/src/v8/cli/schema/generate.ts +6 -6
  369. package/src/v8/cli/schema/index.ts +4 -4
  370. package/src/v8/cli/schema/tsProgram.ts +1 -1
  371. package/src/v8/cli/schema/typeToSchema.ts +24 -2
  372. package/src/v8/cli/serve/server.ts +9 -9
  373. package/src/v8/client.ts +5 -5
  374. package/src/v8/cms.ts +9 -9
  375. package/src/v8/content.ts +4 -4
  376. package/src/v8/draft.ts +1 -1
  377. package/src/v8/errors.ts +1 -1
  378. package/src/v8/fetch.ts +9 -28
  379. package/src/v8/identity.ts +1 -1
  380. package/src/v8/index.ts +5 -5
  381. package/src/v8/matchRoute.ts +1 -1
  382. package/src/v8/remoteLoader.ts +7 -7
  383. package/src/v8/resolver.ts +6 -6
  384. package/src/v8/secrets.ts +1 -1
  385. package/src/v8/telemetry.ts +6 -6
  386. package/src/cms/applySectionConventions.ts +0 -148
  387. package/src/cms/blockSource.ts +0 -228
  388. package/src/cms/client.ts +0 -85
  389. package/src/cms/deferredTrigger.ts +0 -58
  390. package/src/cms/draftSource.ts +0 -476
  391. package/src/cms/index.ts +0 -180
  392. package/src/cms/loadDecofileDirectory.ts +0 -89
  393. package/src/cms/loader.ts +0 -563
  394. package/src/cms/registry.ts +0 -264
  395. package/src/cms/renderJson.ts +0 -179
  396. package/src/cms/resolve.ts +0 -2583
  397. package/src/cms/schema.ts +0 -1219
  398. package/src/cms/sectionLoaderContext.ts +0 -113
  399. package/src/cms/sectionLoaders.ts +0 -686
  400. package/src/cms/sectionMixins.ts +0 -153
  401. package/src/flags/audience.ts +0 -56
  402. package/src/flags/everyone.ts +0 -29
  403. package/src/flags/flag.ts +0 -15
  404. package/src/flags/multivariate/image.ts +0 -11
  405. package/src/flags/multivariate/message.ts +0 -11
  406. package/src/flags/multivariate/page.ts +0 -16
  407. package/src/flags/multivariate/section.ts +0 -16
  408. package/src/flags/multivariate.ts +0 -1
  409. package/src/flags/types.ts +0 -59
  410. package/src/flags/utils/multivariate.ts +0 -20
  411. package/src/hooks/Image.tsx +0 -314
  412. package/src/hooks/JsonLd.tsx +0 -353
  413. package/src/hooks/LazySection.tsx +0 -121
  414. package/src/hooks/LiveControls.tsx +0 -144
  415. package/src/hooks/Picture.tsx +0 -127
  416. package/src/hooks/RenderSection.tsx +0 -91
  417. package/src/hooks/SectionErrorFallback.tsx +0 -97
  418. package/src/hooks/Stats.tsx +0 -134
  419. package/src/hooks/index.ts +0 -35
  420. package/src/hooks/useLoadMore.ts +0 -100
  421. package/src/matchers/builtins.ts +0 -459
  422. package/src/matchers/countryNames.ts +0 -104
  423. package/src/matchers/override.ts +0 -136
  424. package/src/matchers/posthog.ts +0 -154
  425. package/src/middleware/decoState.ts +0 -55
  426. package/src/middleware/healthMetrics.ts +0 -133
  427. package/src/middleware/hydrationContext.ts +0 -79
  428. package/src/middleware/index.ts +0 -88
  429. package/src/middleware/liveness.ts +0 -21
  430. package/src/middleware/observability.ts +0 -800
  431. package/src/middleware/validateSection.ts +0 -100
  432. package/src/preview/DraftPreviewBadge.tsx +0 -306
  433. package/src/preview/decoMark.ts +0 -11
  434. package/src/preview/index.ts +0 -8
  435. package/src/sdk/abTesting.ts +0 -556
  436. package/src/sdk/analytics.ts +0 -147
  437. package/src/sdk/cacheHeaders.ts +0 -633
  438. package/src/sdk/cacheStorage.ts +0 -287
  439. package/src/sdk/cachedLoader.ts +0 -556
  440. package/src/sdk/clx.ts +0 -5
  441. package/src/sdk/cn.ts +0 -28
  442. package/src/sdk/composite.ts +0 -114
  443. package/src/sdk/cookie.ts +0 -129
  444. package/src/sdk/crypto.ts +0 -199
  445. package/src/sdk/csp.ts +0 -59
  446. package/src/sdk/deepOmit.ts +0 -52
  447. package/src/sdk/detectDevice.ts +0 -45
  448. package/src/sdk/djb2.ts +0 -20
  449. package/src/sdk/encoding.ts +0 -44
  450. package/src/sdk/env.ts +0 -54
  451. package/src/sdk/experiments.ts +0 -314
  452. package/src/sdk/fetchCache.ts +0 -269
  453. package/src/sdk/fetchTimeout.ts +0 -58
  454. package/src/sdk/flags.ts +0 -138
  455. package/src/sdk/http.ts +0 -124
  456. package/src/sdk/index.ts +0 -97
  457. package/src/sdk/inflightTimeout.ts +0 -53
  458. package/src/sdk/instrumentedFetch.ts +0 -362
  459. package/src/sdk/invoke.ts +0 -298
  460. package/src/sdk/logger.ts +0 -304
  461. package/src/sdk/mergeCacheControl.ts +0 -150
  462. package/src/sdk/nonce.ts +0 -46
  463. package/src/sdk/normalizeUrls.ts +0 -91
  464. package/src/sdk/observability.ts +0 -116
  465. package/src/sdk/otel.ts +0 -1118
  466. package/src/sdk/otelAdapters/clickhouseCollector.ts +0 -65
  467. package/src/sdk/otelAdapters.ts +0 -144
  468. package/src/sdk/otelHttpLog.ts +0 -419
  469. package/src/sdk/otelHttpMeter.ts +0 -532
  470. package/src/sdk/otelHttpTracer.ts +0 -543
  471. package/src/sdk/redirects.ts +0 -336
  472. package/src/sdk/requestContext.ts +0 -281
  473. package/src/sdk/requestContextStorage.browser.ts +0 -43
  474. package/src/sdk/requestContextStorage.ts +0 -35
  475. package/src/sdk/responseCache.ts +0 -82
  476. package/src/sdk/retry.ts +0 -45
  477. package/src/sdk/serverTimings.ts +0 -68
  478. package/src/sdk/signal.ts +0 -42
  479. package/src/sdk/sitemap.ts +0 -160
  480. package/src/sdk/urlRedaction.ts +0 -82
  481. package/src/sdk/urlUtils.ts +0 -183
  482. package/src/sdk/useDevice.ts +0 -89
  483. package/src/sdk/useDeviceContext.tsx +0 -108
  484. package/src/sdk/useId.ts +0 -7
  485. package/src/sdk/useScript.ts +0 -210
  486. package/src/sdk/useSuggestions.ts +0 -188
  487. package/src/sdk/wrapCaughtErrors.ts +0 -107
  488. package/src/setup.ts +0 -120
  489. package/src/types/index.ts +0 -53
  490. package/src/types/widgets.ts +0 -14
package/src/cms/schema.ts DELETED
@@ -1,1219 +0,0 @@
1
- /**
2
- * Framework-level schema definitions and runtime meta composition.
3
- *
4
- * The schema generator (scripts/generate-schema.ts) produces section and app
5
- * schemas from site TypeScript files. Framework-managed block types -- pages,
6
- * loaders, matchers, flags -- have their schemas defined here and injected
7
- * at runtime via composeMeta().
8
- *
9
- * This keeps the generator focused on site-specific concerns while the
10
- * framework owns the schemas for its own block types.
11
- */
12
-
13
- export interface MetaResponse {
14
- major: number;
15
- version: string;
16
- namespace: string;
17
- site: string;
18
- manifest: {
19
- blocks: Record<string, Record<string, { $ref: string; namespace?: string }>>;
20
- };
21
- schema: {
22
- definitions: Record<string, any>;
23
- root: Record<string, any>;
24
- };
25
- platform?: string;
26
- cloudProvider?: string;
27
- framework?: string;
28
- etag?: string;
29
- }
30
-
31
- /**
32
- * Standard base64 encoding that matches the browser's btoa().
33
- * The admin uses btoa(resolveType) in some code paths to construct
34
- * definition refs, so our keys MUST include the = padding.
35
- */
36
- function toBase64(str: string): string {
37
- if (typeof btoa === "function") return btoa(str);
38
- return Buffer.from(str).toString("base64");
39
- }
40
-
41
- // The admin's deRefUntil and ArrayFieldTemplate look for the LITERAL
42
- // string "Resolvable" (not base64-encoded). Both keys are needed:
43
- // - literal for admin detection
44
- // - base64 for backward compat with any code that does btoa("Resolvable")
45
- const RESOLVABLE_LITERAL_KEY = "Resolvable";
46
- const RESOLVABLE_B64_KEY = toBase64("Resolvable");
47
-
48
- function buildResolvableDefinition() {
49
- return {
50
- title: "Select from saved",
51
- type: "object",
52
- required: ["__resolveType"],
53
- additionalProperties: true,
54
- properties: { __resolveType: { type: "string" } },
55
- };
56
- }
57
-
58
- // ---------------------------------------------------------------------------
59
- // Loader definitions — dynamic registry
60
- // ---------------------------------------------------------------------------
61
-
62
- export interface LoaderConfig {
63
- key: string;
64
- title: string;
65
- namespace: string;
66
- description?: string;
67
- icon?: string;
68
- propsSchema: Record<string, any>;
69
- /** Tags for property matching (e.g., "product-list" enables injection into Product[] props). */
70
- tags?: string[];
71
- /**
72
- * Auto-registered placeholder with no real props (see registerCommerceLoaders).
73
- * A stub never overwrites a real schema for the same key, regardless of
74
- * registration order.
75
- */
76
- isStub?: boolean;
77
- }
78
-
79
- const loaderRegistry: LoaderConfig[] = [];
80
-
81
- /** Register a single loader schema for the admin. */
82
- export function registerLoaderSchema(config: LoaderConfig) {
83
- const idx = loaderRegistry.findIndex((l) => l.key === config.key);
84
- if (idx >= 0) {
85
- if (config.isStub && !loaderRegistry[idx].isStub) return;
86
- loaderRegistry[idx] = config;
87
- } else {
88
- loaderRegistry.push(config);
89
- }
90
- }
91
-
92
- /** Register multiple loader schemas at once. */
93
- export function registerLoaderSchemas(configs: LoaderConfig[]) {
94
- for (const config of configs) registerLoaderSchema(config);
95
- }
96
-
97
- /** Get all registered loader schemas. */
98
- export function getRegisteredLoaders(): LoaderConfig[] {
99
- return [...loaderRegistry];
100
- }
101
-
102
- function getProductListLoaderKeys(): string[] {
103
- return loaderRegistry.filter((l) => l.tags?.includes("product-list")).map((l) => l.key);
104
- }
105
-
106
- // ---------------------------------------------------------------------------
107
- // Action definitions — dynamic registry
108
- // ---------------------------------------------------------------------------
109
-
110
- export interface ActionConfig {
111
- key: string;
112
- title: string;
113
- namespace: string;
114
- description?: string;
115
- icon?: string;
116
- propsSchema: Record<string, any>;
117
- /** Auto-registered placeholder — never overwrites a real schema. See LoaderConfig.isStub. */
118
- isStub?: boolean;
119
- }
120
-
121
- const actionRegistry: ActionConfig[] = [];
122
-
123
- /** Register a single action schema for the admin. */
124
- export function registerActionSchema(config: ActionConfig) {
125
- const idx = actionRegistry.findIndex((a) => a.key === config.key);
126
- if (idx >= 0) {
127
- if (config.isStub && !actionRegistry[idx].isStub) return;
128
- actionRegistry[idx] = config;
129
- } else {
130
- actionRegistry.push(config);
131
- }
132
- }
133
-
134
- /** Register multiple action schemas at once. */
135
- export function registerActionSchemas(configs: ActionConfig[]) {
136
- for (const config of configs) registerActionSchema(config);
137
- }
138
-
139
- // ---------------------------------------------------------------------------
140
- // App block schemas — real props generated at app build time
141
- // ---------------------------------------------------------------------------
142
-
143
- /**
144
- * Loader keys matching these substrings return product lists — the admin uses
145
- * the "product-list" tag to offer them as loader pickers on Product[] props.
146
- */
147
- export function inferLoaderTags(key: string): string[] {
148
- if (
149
- key.includes("productList") ||
150
- key.includes("ProductList") ||
151
- key.includes("ProductShelf") ||
152
- key.includes("SearchResult")
153
- ) {
154
- return ["product-list"];
155
- }
156
- return [];
157
- }
158
-
159
- /**
160
- * Props schema of a single loader/action as emitted by blocks-cli's
161
- * generate-app-schemas.ts into an app package's src/schemas.gen.ts.
162
- * Same shape generate-schema.ts produces for site loaders.
163
- */
164
- export interface BlockPropsSchema {
165
- type?: "object";
166
- title?: string;
167
- description?: string;
168
- properties?: Record<string, any>;
169
- required?: string[];
170
- additionalProperties?: boolean;
171
- /** Any other JSON Schema keyword or JSDoc passthrough tag (nullable, …). */
172
- [keyword: string]: any;
173
- }
174
-
175
- export interface AppSchemas {
176
- namespace: string;
177
- loaders?: Record<string, BlockPropsSchema>;
178
- actions?: Record<string, BlockPropsSchema>;
179
- }
180
-
181
- /**
182
- * Register the real loader/action props schemas an app package generated at
183
- * build time (src/schemas.gen.ts). These take precedence over the
184
- * `__resolveType`-only stubs auto-registered by registerCommerceLoaders(),
185
- * regardless of which side registers first.
186
- */
187
- export function registerAppSchemas(app: AppSchemas): void {
188
- const loaderConfigs: LoaderConfig[] = Object.entries(app.loaders ?? {}).map(([key, schema]) => ({
189
- key,
190
- title: schema.title || key,
191
- namespace: app.namespace,
192
- ...(schema.description ? { description: schema.description } : {}),
193
- propsSchema: schema,
194
- tags: inferLoaderTags(key),
195
- }));
196
- const actionConfigs: ActionConfig[] = Object.entries(app.actions ?? {}).map(([key, schema]) => ({
197
- key,
198
- title: schema.title || key,
199
- namespace: app.namespace,
200
- ...(schema.description ? { description: schema.description } : {}),
201
- propsSchema: schema,
202
- }));
203
- registerLoaderSchemas(loaderConfigs);
204
- registerActionSchemas(actionConfigs);
205
- }
206
-
207
- function buildActionDefinitions() {
208
- const definitions: Record<string, any> = {};
209
- const manifestBlocks: Record<string, any> = {};
210
-
211
- for (const action of actionRegistry) {
212
- const defKey = toBase64(action.key);
213
-
214
- definitions[defKey] = {
215
- title: action.title || action.key,
216
- ...(action.description ? { description: action.description } : {}),
217
- ...(action.icon ? { icon: action.icon } : {}),
218
- type: "object",
219
- required: ["__resolveType", ...(action.propsSchema?.required || [])],
220
- properties: {
221
- __resolveType: {
222
- type: "string",
223
- enum: [action.key],
224
- default: action.key,
225
- },
226
- ...(action.propsSchema?.properties || {}),
227
- },
228
- // Preserved so the admin can tell "props unknown — edit as JSON" (stub)
229
- // apart from "takes no input" (real schema without the flag).
230
- ...(action.propsSchema?.additionalProperties === true ? { additionalProperties: true } : {}),
231
- };
232
-
233
- manifestBlocks[action.key] = {
234
- $ref: `#/definitions/${defKey}`,
235
- namespace: action.namespace,
236
- };
237
- }
238
-
239
- return { definitions, manifestBlocks };
240
- }
241
-
242
- // ---------------------------------------------------------------------------
243
- // Matcher definitions — dynamic registry
244
- // ---------------------------------------------------------------------------
245
-
246
- export interface MatcherConfig {
247
- key: string;
248
- title: string;
249
- namespace: string;
250
- description?: string;
251
- icon?: string;
252
- propsSchema?: Record<string, any>;
253
- }
254
-
255
- const matcherRegistry: MatcherConfig[] = [];
256
-
257
- /** Register a single matcher schema for the admin. */
258
- export function registerMatcherSchema(config: MatcherConfig) {
259
- const idx = matcherRegistry.findIndex((m) => m.key === config.key);
260
- if (idx >= 0) {
261
- matcherRegistry[idx] = config;
262
- } else {
263
- matcherRegistry.push(config);
264
- }
265
- }
266
-
267
- /** Register multiple matcher schemas at once. */
268
- export function registerMatcherSchemas(configs: MatcherConfig[]) {
269
- for (const config of configs) registerMatcherSchema(config);
270
- }
271
-
272
- /** Get all registered matcher schemas. */
273
- export function getRegisteredMatchers(): MatcherConfig[] {
274
- return matcherRegistry;
275
- }
276
-
277
- // Register built-in matchers that are always available
278
- registerMatcherSchemas([
279
- {
280
- key: "website/matchers/always.ts",
281
- title: "Always",
282
- description: "Target all users",
283
- icon: "eye",
284
- namespace: "website",
285
- },
286
- {
287
- key: "website/matchers/never.ts",
288
- title: "Never",
289
- description: "Hide from all users",
290
- icon: "eye-off",
291
- namespace: "website",
292
- },
293
- {
294
- key: "website/matchers/device.ts",
295
- title: "Device",
296
- description: "Target users based on their device type, such as desktop, tablet, or mobile",
297
- icon: "device-mobile",
298
- namespace: "website",
299
- propsSchema: {
300
- type: "object",
301
- properties: {
302
- mobile: { type: "boolean", title: "Mobile" },
303
- desktop: { type: "boolean", title: "Desktop" },
304
- },
305
- },
306
- },
307
- {
308
- key: "website/matchers/date.ts",
309
- title: "Date and Time",
310
- description: "Target users based on specific dates or date ranges, including specific times",
311
- icon: "calendar-event",
312
- namespace: "website",
313
- propsSchema: {
314
- type: "object",
315
- properties: {
316
- start: { type: "string", title: "Start Date", format: "date-time" },
317
- end: { type: "string", title: "End Date", format: "date-time" },
318
- },
319
- },
320
- },
321
- {
322
- key: "website/matchers/cron.ts",
323
- title: "Cron",
324
- description: "Target users with precision using recurring schedules",
325
- icon: "refresh",
326
- namespace: "website",
327
- propsSchema: {
328
- type: "object",
329
- properties: {
330
- start: { type: "string", title: "Start", format: "date-time" },
331
- end: { type: "string", title: "End", format: "date-time" },
332
- },
333
- },
334
- },
335
- {
336
- key: "website/matchers/cookie.ts",
337
- title: "Cookie",
338
- description: "Target users that have a specific cookie",
339
- icon: "cookie",
340
- namespace: "website",
341
- propsSchema: {
342
- type: "object",
343
- properties: {
344
- name: { type: "string", title: "Cookie Name" },
345
- value: { type: "string", title: "Cookie Value" },
346
- },
347
- },
348
- },
349
- {
350
- key: "website/matchers/host.ts",
351
- title: "Host",
352
- description: "Target users based on the domain or subdomain they are accessing your site from",
353
- icon: "world-www",
354
- namespace: "website",
355
- propsSchema: {
356
- type: "object",
357
- properties: {
358
- host: { type: "string", title: "Hostname" },
359
- },
360
- },
361
- },
362
- {
363
- key: "website/matchers/pathname.ts",
364
- title: "Pathname",
365
- description: "Target users based on the pathname",
366
- icon: "world-www",
367
- namespace: "website",
368
- propsSchema: {
369
- type: "object",
370
- properties: {
371
- pattern: { type: "string", title: "Regex Pattern" },
372
- includes: {
373
- type: "array",
374
- title: "Includes",
375
- items: { type: "string" },
376
- },
377
- excludes: {
378
- type: "array",
379
- title: "Excludes",
380
- items: { type: "string" },
381
- },
382
- },
383
- },
384
- },
385
- {
386
- key: "website/matchers/queryString.ts",
387
- title: "Query String",
388
- description: "Match with a specific querystring",
389
- icon: "question-mark",
390
- namespace: "website",
391
- propsSchema: {
392
- type: "object",
393
- properties: {
394
- key: { type: "string", title: "Parameter Name" },
395
- value: { type: "string", title: "Parameter Value" },
396
- },
397
- },
398
- },
399
- {
400
- key: "website/matchers/random.ts",
401
- title: "Random",
402
- description: "Target a percentage of the total traffic to do an A/B test",
403
- icon: "arrow-split",
404
- namespace: "website",
405
- propsSchema: {
406
- type: "object",
407
- properties: {
408
- traffic: {
409
- type: "number",
410
- title: "Traffic Percentage (0\u20131)",
411
- minimum: 0,
412
- maximum: 1,
413
- },
414
- },
415
- },
416
- },
417
- {
418
- key: "website/matchers/location.ts",
419
- title: "Location",
420
- description:
421
- "Target users based on their geographical location, such as country, city, or region",
422
- icon: "map-2",
423
- namespace: "website",
424
- propsSchema: (() => {
425
- // `includeLocations`/`excludeLocations` are `(Location | Map)[]` in the
426
- // matcher source. Emit the union as an `anyOf` of two branches so the CMS
427
- // renders a Location/Map choice instead of merging every field into one
428
- // form. The Location branch is exactly {city, regionCode, country}; the
429
- // Map branch carries the `@format: map` coordinate picker.
430
- const locationBranch = {
431
- type: "object" as const,
432
- title: "Location",
433
- properties: {
434
- city: {
435
- type: "string",
436
- title: "City",
437
- examples: ["São Paulo"],
438
- description:
439
- "Exact city name (case-insensitive) as returned by Cloudflare's cf-ipcity header.",
440
- },
441
- regionCode: {
442
- type: "string",
443
- title: "Region Code",
444
- examples: ["SP", "RJ", "MG", "47"],
445
- description:
446
- 'Matches Cloudflare\'s cf-region-code header. Usually the ISO 3166-2 subdivision code (SP, RJ, MG, …); for some regions Cloudflare returns numeric codes (e.g. 47). Use the same value cf-region-code returns for your audience — full region names like "São Paulo" are NOT matched.',
447
- },
448
- country: {
449
- type: "string",
450
- title: "Country",
451
- examples: ["BR", "Brasil", "US"],
452
- description:
453
- "ISO 3166-1 alpha-2 code (BR, US, AR, …) or a full country name (Brasil, United States) — the matcher resolves common aliases.",
454
- },
455
- },
456
- };
457
- const mapBranch = {
458
- type: "object" as const,
459
- title: "Map",
460
- properties: {
461
- coordinates: {
462
- type: "string",
463
- title: "Area selection",
464
- format: "map",
465
- examples: ["-23.5505,-46.6333,5000"],
466
- description:
467
- '"latitude,longitude,radius_in_meters" for haversine-radius matching. Set this for the Map mode.',
468
- },
469
- },
470
- };
471
- // Mustache title so array items summarise their content instead of
472
- // "Item 1". Absent fields render empty; the label is trimmed. Covers both
473
- // branches — Location fields and the Map coordinates.
474
- const locationOrMapItem = {
475
- title: "{{{city}}} {{{regionCode}}} {{{country}}} {{{coordinates}}}",
476
- anyOf: [locationBranch, mapBranch],
477
- };
478
- return {
479
- type: "object" as const,
480
- properties: {
481
- includeLocations: {
482
- type: "array",
483
- title: "Include Locations",
484
- items: locationOrMapItem,
485
- },
486
- excludeLocations: {
487
- type: "array",
488
- title: "Exclude Locations",
489
- items: locationOrMapItem,
490
- },
491
- },
492
- };
493
- })(),
494
- },
495
- {
496
- key: "website/matchers/userAgent.ts",
497
- title: "User Agent",
498
- description: "Target users based on their web browser or operational system",
499
- icon: "world",
500
- namespace: "website",
501
- propsSchema: {
502
- type: "object",
503
- properties: {
504
- includes: { type: "string", title: "Includes (substring)" },
505
- match: { type: "string", title: "Match (regex)" },
506
- },
507
- },
508
- },
509
- {
510
- key: "website/matchers/environment.ts",
511
- title: "Environment",
512
- description:
513
- "Target users based from where they are accessing your site (development, testing, or production)",
514
- icon: "code",
515
- namespace: "website",
516
- propsSchema: {
517
- type: "object",
518
- properties: {
519
- environment: {
520
- type: "string",
521
- title: "Environment",
522
- enum: ["production", "development"],
523
- },
524
- },
525
- },
526
- },
527
- {
528
- key: "website/matchers/multi.ts",
529
- title: "Multi",
530
- description: "Create more complex conditions by combining multiple matchers",
531
- icon: "plus",
532
- namespace: "website",
533
- propsSchema: {
534
- type: "object",
535
- properties: {
536
- op: {
537
- type: "string",
538
- title: "Operator",
539
- enum: ["and", "or"],
540
- default: "and",
541
- },
542
- matchers: {
543
- type: "array",
544
- title: "Matchers",
545
- items: { $ref: "#/root/matchers" },
546
- },
547
- },
548
- },
549
- },
550
- {
551
- key: "website/matchers/negate.ts",
552
- title: "Negates",
553
- description: "Create conditions that target users who do not meet certain criteria",
554
- icon: "minus",
555
- namespace: "website",
556
- propsSchema: {
557
- type: "object",
558
- properties: {
559
- matcher: {
560
- $ref: "#/root/matchers",
561
- title: "Matcher",
562
- },
563
- },
564
- },
565
- },
566
- ]);
567
-
568
- function buildLoaderDefinitions() {
569
- const definitions: Record<string, any> = {};
570
- const manifestBlocks: Record<string, any> = {};
571
- const loaderAnyOf: any[] = [{ $ref: `#/definitions/${RESOLVABLE_LITERAL_KEY}` }];
572
-
573
- for (const loader of loaderRegistry) {
574
- const defKey = toBase64(loader.key);
575
-
576
- definitions[defKey] = {
577
- title: loader.title || loader.key,
578
- ...(loader.description ? { description: loader.description } : {}),
579
- ...(loader.icon ? { icon: loader.icon } : {}),
580
- type: "object",
581
- required: ["__resolveType", ...(loader.propsSchema?.required || [])],
582
- properties: {
583
- __resolveType: {
584
- type: "string",
585
- enum: [loader.key],
586
- default: loader.key,
587
- },
588
- ...(loader.propsSchema?.properties || {}),
589
- },
590
- // Preserved so the admin can tell "props unknown — edit as JSON" (stub)
591
- // apart from "takes no input" (real schema without the flag).
592
- ...(loader.propsSchema?.additionalProperties === true ? { additionalProperties: true } : {}),
593
- };
594
-
595
- manifestBlocks[loader.key] = {
596
- $ref: `#/definitions/${defKey}`,
597
- namespace: loader.namespace,
598
- };
599
-
600
- loaderAnyOf.push({ $ref: `#/definitions/${defKey}` });
601
- }
602
-
603
- return { definitions, manifestBlocks, loaderAnyOf };
604
- }
605
-
606
- // ---------------------------------------------------------------------------
607
- // Matcher definitions
608
- // ---------------------------------------------------------------------------
609
-
610
- function buildMatcherDefinitions() {
611
- const definitions: Record<string, any> = {};
612
- const manifestBlocks: Record<string, any> = {};
613
- const matcherAnyOf: any[] = [{ $ref: `#/definitions/${RESOLVABLE_LITERAL_KEY}` }];
614
-
615
- for (const matcher of matcherRegistry) {
616
- const defKey = toBase64(matcher.key);
617
- definitions[defKey] = {
618
- title: matcher.title,
619
- ...(matcher.description ? { description: matcher.description } : {}),
620
- ...(matcher.icon ? { icon: matcher.icon } : {}),
621
- type: "object",
622
- required: ["__resolveType"],
623
- properties: {
624
- __resolveType: {
625
- type: "string",
626
- enum: [matcher.key],
627
- default: matcher.key,
628
- },
629
- ...(matcher.propsSchema?.properties || {}),
630
- },
631
- ...(matcher.propsSchema?.additionalProperties === true ? { additionalProperties: true } : {}),
632
- };
633
- manifestBlocks[matcher.key] = {
634
- $ref: `#/definitions/${defKey}`,
635
- namespace: matcher.namespace,
636
- };
637
- matcherAnyOf.push({ $ref: `#/definitions/${defKey}` });
638
- }
639
-
640
- return { definitions, manifestBlocks, matcherAnyOf };
641
- }
642
-
643
- // ---------------------------------------------------------------------------
644
- // Multivariate flag schema
645
- // ---------------------------------------------------------------------------
646
-
647
- function buildMultivariateFlagSchema(innerSchema: any) {
648
- return {
649
- type: "object",
650
- required: ["__resolveType"],
651
- properties: {
652
- __resolveType: {
653
- type: "string",
654
- enum: ["website/flags/multivariate.ts", "website/flags/multivariate/section.ts"],
655
- },
656
- variants: {
657
- type: "array",
658
- title: "Variants",
659
- items: {
660
- type: "object",
661
- properties: {
662
- rule: {
663
- title: "Rule",
664
- type: "object",
665
- required: ["__resolveType"],
666
- properties: {
667
- __resolveType: { type: "string" },
668
- },
669
- additionalProperties: true,
670
- },
671
- value: innerSchema,
672
- },
673
- },
674
- },
675
- },
676
- };
677
- }
678
-
679
- // ---------------------------------------------------------------------------
680
- // Page schema
681
- // ---------------------------------------------------------------------------
682
-
683
- function buildPageSchema(sectionAnyOf: any[]) {
684
- const PAGE_TYPE = "website/pages/Page.tsx";
685
- const defKey = toBase64(PAGE_TYPE);
686
-
687
- const sectionsArraySchema = {
688
- type: "array",
689
- title: "Sections",
690
- items: { anyOf: sectionAnyOf },
691
- };
692
-
693
- const sectionsMultivariateSchema = buildMultivariateFlagSchema(sectionsArraySchema);
694
-
695
- const definition = {
696
- title: PAGE_TYPE,
697
- type: "object",
698
- required: ["__resolveType"],
699
- properties: {
700
- __resolveType: {
701
- type: "string",
702
- enum: [PAGE_TYPE],
703
- default: PAGE_TYPE,
704
- },
705
- name: { type: "string", title: "Name" },
706
- path: { type: "string", title: "Path" },
707
- seo: { title: "SEO", anyOf: sectionAnyOf },
708
- sections: {
709
- title: "Sections",
710
- anyOf: [sectionsArraySchema, sectionsMultivariateSchema],
711
- },
712
- },
713
- };
714
-
715
- return {
716
- definitions: { [defKey]: definition },
717
- manifestBlocks: {
718
- [PAGE_TYPE]: {
719
- $ref: `#/definitions/${defKey}`,
720
- namespace: "website",
721
- },
722
- },
723
- rootAnyOf: [
724
- { $ref: `#/definitions/${RESOLVABLE_LITERAL_KEY}` },
725
- { $ref: `#/definitions/${defKey}` },
726
- ],
727
- };
728
- }
729
-
730
- // ---------------------------------------------------------------------------
731
- // Framework sections
732
- // ---------------------------------------------------------------------------
733
-
734
- // Merchant-facing help for the per-section `ignoreStructuredData` toggle, shared
735
- // by the PLP (`configJsonLD`) and PDP (top-level) SEO sections. The fetch-skip is
736
- // deliberately scoped to "the page's SEO source" — it only fires when this block
737
- // is wired as the page's SEO (`page.seo`), not when the section is dropped inline
738
- // in the sections array (there the commerce loader still runs; only the JSON-LD
739
- // output is omitted for visitors).
740
- const IGNORE_STRUCTURED_DATA_DESCRIPTION =
741
- "By default, Structured Data (JSON-LD) is sent to everyone. Turn this on to omit it for regular visitors while crawlers and bots still receive the full Structured Data. When this block is the page's SEO source, the product fetch is also skipped for visitors, so the page loads faster. Some integrations may rely on Structured Data being present for all users.";
742
-
743
- function buildFrameworkSections(sectionAnyOf: any[], loaderUnion: any[]) {
744
- const definitions: Record<string, any> = {};
745
- const manifestBlocks: Record<string, any> = {};
746
- const extraAnyOf: any[] = [];
747
-
748
- // --- website/sections/Rendering/Lazy.tsx ---
749
- const LAZY_TYPE = "website/sections/Rendering/Lazy.tsx";
750
- const lazyKey = toBase64(LAZY_TYPE);
751
- definitions[lazyKey] = {
752
- title: LAZY_TYPE,
753
- type: "object",
754
- required: ["__resolveType"],
755
- properties: {
756
- __resolveType: {
757
- type: "string",
758
- enum: [LAZY_TYPE],
759
- default: LAZY_TYPE,
760
- },
761
- section: {
762
- title: "Section",
763
- anyOf: sectionAnyOf,
764
- },
765
- },
766
- };
767
- manifestBlocks[LAZY_TYPE] = {
768
- $ref: `#/definitions/${lazyKey}`,
769
- namespace: "website",
770
- };
771
- extraAnyOf.push({ $ref: `#/definitions/${lazyKey}` });
772
-
773
- // --- website/sections/Seo/Seo.tsx ---
774
- const SEO_TYPE = "website/sections/Seo/Seo.tsx";
775
- const seoKey = toBase64(SEO_TYPE);
776
- definitions[seoKey] = {
777
- title: SEO_TYPE,
778
- type: "object",
779
- required: ["__resolveType"],
780
- properties: {
781
- __resolveType: {
782
- type: "string",
783
- enum: [SEO_TYPE],
784
- default: SEO_TYPE,
785
- },
786
- title: { type: "string", title: "Title" },
787
- description: { type: "string", title: "Description" },
788
- canonical: { type: "string", title: "Canonical URL" },
789
- favicon: { type: "string", title: "Favicon", format: "image-uri" },
790
- noIndexing: { type: "boolean", title: "No Indexing" },
791
- titleTemplate: { type: "string", title: "Title Template" },
792
- descriptionTemplate: { type: "string", title: "Description Template" },
793
- type: { type: "string", title: "Page Type" },
794
- image: { type: "string", title: "OG Image", format: "image-uri" },
795
- themeColor: { type: "string", title: "Theme Color", format: "color" },
796
- jsonLDs: {
797
- type: "array",
798
- title: "JSON-LD Structured Data",
799
- items: { type: "object", additionalProperties: true },
800
- },
801
- },
802
- };
803
- manifestBlocks[SEO_TYPE] = {
804
- $ref: `#/definitions/${seoKey}`,
805
- namespace: "website",
806
- };
807
- extraAnyOf.push({ $ref: `#/definitions/${seoKey}` });
808
-
809
- // --- website/sections/Seo/SeoV2.tsx ---
810
- const SEOV2_TYPE = "website/sections/Seo/SeoV2.tsx";
811
- const seoV2Key = toBase64(SEOV2_TYPE);
812
- definitions[seoV2Key] = {
813
- title: SEOV2_TYPE,
814
- type: "object",
815
- required: ["__resolveType"],
816
- properties: {
817
- __resolveType: {
818
- type: "string",
819
- enum: [SEOV2_TYPE],
820
- default: SEOV2_TYPE,
821
- },
822
- title: { type: "string", title: "Title" },
823
- description: { type: "string", title: "Description" },
824
- canonical: { type: "string", title: "Canonical URL" },
825
- favicon: { type: "string", title: "Favicon", format: "image-uri" },
826
- noIndexing: { type: "boolean", title: "No Indexing" },
827
- titleTemplate: { type: "string", title: "Title Template" },
828
- descriptionTemplate: { type: "string", title: "Description Template" },
829
- type: { type: "string", title: "Page Type" },
830
- image: { type: "string", title: "OG Image", format: "image-uri" },
831
- themeColor: { type: "string", title: "Theme Color", format: "color" },
832
- jsonLDs: {
833
- type: "array",
834
- title: "JSON-LD Structured Data",
835
- items: { type: "object", additionalProperties: true },
836
- },
837
- },
838
- };
839
- manifestBlocks[SEOV2_TYPE] = {
840
- $ref: `#/definitions/${seoV2Key}`,
841
- namespace: "website",
842
- };
843
- extraAnyOf.push({ $ref: `#/definitions/${seoV2Key}` });
844
-
845
- // --- commerce/sections/Seo/SeoPLPV2.tsx ---
846
- // Product-listing SEO. Its schema is synthesized here (like the website Seo
847
- // sections) because the commerce apps ship loaders/types, not sections — so
848
- // there is no manifest to emit these props from. The Studio's SEO editor
849
- // already knows this type as its "plp" mode (see seo-form-mode.ts); it just
850
- // needs the props schema to render the override fields. `jsonLD` is the
851
- // data-source loader picker (mirrors deco-cx's `@title Data Source`) — an
852
- // inline anyOf over the loader union so the editor lets you pick the PLP/PDP
853
- // loader that feeds the structured data. Inlined (a fresh copy) rather than a
854
- // `$ref: "#/root/loaders"` because the Studio drops the prop-level title when
855
- // resolving a `$ref` union, which would lose the "Data Source" label; the
856
- // copy also avoids sharing one array instance across the two defs + root.
857
- //
858
- // Added to `extraAnyOf` (offered as a selectable page.seo type) unconditionally,
859
- // like the website Seo sections above. Gating this on "is a commerce site" via
860
- // the loader registry does NOT work: meta.gen.json is baked at generation time
861
- // (blocks-cli), when the registry is empty, and the runtime serves that baked,
862
- // already-composed meta as-is (composeMeta is idempotent on it) — so a gate
863
- // would drop the options at bake and never re-add them. Non-commerce sites
864
- // seeing these two extra options is a minor, acceptable cost.
865
- const SEO_PLP_V2_TYPE = "commerce/sections/Seo/SeoPLPV2.tsx";
866
- const seoPlpV2Key = toBase64(SEO_PLP_V2_TYPE);
867
- definitions[seoPlpV2Key] = {
868
- title: SEO_PLP_V2_TYPE,
869
- type: "object",
870
- required: ["__resolveType"],
871
- properties: {
872
- __resolveType: {
873
- type: "string",
874
- enum: [SEO_PLP_V2_TYPE],
875
- default: SEO_PLP_V2_TYPE,
876
- },
877
- jsonLD: { title: "Data Source", anyOf: [...loaderUnion] },
878
- title: { type: "string", title: "Title Override" },
879
- description: { type: "string", title: "Description Override" },
880
- noIndexing: { type: "boolean", title: "Disable indexing" },
881
- configJsonLD: {
882
- type: "object",
883
- title: "Structured Data",
884
- properties: {
885
- removeVideos: {
886
- type: "boolean",
887
- title: "Remove videos (deprecated)",
888
- description: "No effect: listing structured data is an ItemList, which carries no videos.",
889
- },
890
- ignoreStructuredData: {
891
- type: "boolean",
892
- title: "Ignore Structured Data",
893
- description: IGNORE_STRUCTURED_DATA_DESCRIPTION,
894
- },
895
- },
896
- },
897
- },
898
- };
899
- manifestBlocks[SEO_PLP_V2_TYPE] = {
900
- $ref: `#/definitions/${seoPlpV2Key}`,
901
- namespace: "commerce",
902
- };
903
- extraAnyOf.push({ $ref: `#/definitions/${seoPlpV2Key}` });
904
-
905
- // --- commerce/sections/Seo/SeoPDPV2.tsx ---
906
- // Product-details SEO. Studio "pdp" mode counterpart of the PLP section above.
907
- const SEO_PDP_V2_TYPE = "commerce/sections/Seo/SeoPDPV2.tsx";
908
- const seoPdpV2Key = toBase64(SEO_PDP_V2_TYPE);
909
- definitions[seoPdpV2Key] = {
910
- title: SEO_PDP_V2_TYPE,
911
- type: "object",
912
- required: ["__resolveType"],
913
- properties: {
914
- __resolveType: {
915
- type: "string",
916
- enum: [SEO_PDP_V2_TYPE],
917
- default: SEO_PDP_V2_TYPE,
918
- },
919
- jsonLD: { title: "Data Source", anyOf: [...loaderUnion] },
920
- omitVariants: { type: "boolean", title: "Omit variants" },
921
- title: { type: "string", title: "Title Override" },
922
- description: { type: "string", title: "Description Override" },
923
- noIndexing: { type: "boolean", title: "Disable indexing" },
924
- ignoreStructuredData: {
925
- type: "boolean",
926
- title: "Ignore Structured Data",
927
- description: IGNORE_STRUCTURED_DATA_DESCRIPTION,
928
- },
929
- },
930
- };
931
- manifestBlocks[SEO_PDP_V2_TYPE] = {
932
- $ref: `#/definitions/${seoPdpV2Key}`,
933
- namespace: "commerce",
934
- };
935
- extraAnyOf.push({ $ref: `#/definitions/${seoPdpV2Key}` });
936
-
937
- // --- website/flags/multivariate/section.ts ---
938
- const MV_SECTION_TYPE = "website/flags/multivariate/section.ts";
939
- const mvSectionKey = toBase64(MV_SECTION_TYPE);
940
- definitions[mvSectionKey] = {
941
- title: MV_SECTION_TYPE,
942
- type: "object",
943
- required: ["__resolveType"],
944
- properties: {
945
- __resolveType: {
946
- type: "string",
947
- enum: [MV_SECTION_TYPE],
948
- default: MV_SECTION_TYPE,
949
- },
950
- variants: {
951
- type: "array",
952
- title: "Variants",
953
- items: {
954
- type: "object",
955
- properties: {
956
- rule: {
957
- title: "Rule",
958
- type: "object",
959
- required: ["__resolveType"],
960
- properties: { __resolveType: { type: "string" } },
961
- additionalProperties: true,
962
- },
963
- value: {
964
- title: "Section",
965
- anyOf: sectionAnyOf,
966
- },
967
- },
968
- },
969
- },
970
- },
971
- };
972
- manifestBlocks[MV_SECTION_TYPE] = {
973
- $ref: `#/definitions/${mvSectionKey}`,
974
- namespace: "website",
975
- };
976
- extraAnyOf.push({ $ref: `#/definitions/${mvSectionKey}` });
977
-
978
- return { definitions, manifestBlocks, extraAnyOf };
979
- }
980
-
981
- // ---------------------------------------------------------------------------
982
- // Post-processing: wrap complex properties with Resolvable anyOf
983
- // ---------------------------------------------------------------------------
984
-
985
- /**
986
- * Walk all @Props definitions and wrap complex array/object properties
987
- * with anyOf [Resolvable, original, ...matchingLoaders].
988
- *
989
- * In the deco CMS, ANY complex property can be replaced by a loader
990
- * reference ({ __resolveType: "some/loader.ts", props: {...} }).
991
- * This function ensures the schema accepts both inline data and
992
- * loader references for all such properties.
993
- */
994
- function wrapResolvableProperties(
995
- definitions: Record<string, any>,
996
- _loaderDefinitions: Record<string, any>,
997
- ) {
998
- const resolvableRef = { $ref: `#/definitions/${RESOLVABLE_LITERAL_KEY}` };
999
-
1000
- const productLoaderRefs = getProductListLoaderKeys().map((key) => ({
1001
- $ref: `#/definitions/${toBase64(key)}`,
1002
- }));
1003
-
1004
- for (const [defKey, def] of Object.entries(definitions)) {
1005
- if (!defKey.endsWith("@Props")) continue;
1006
- if (!def || !def.properties) continue;
1007
-
1008
- for (const [propName, propSchema] of Object.entries(def.properties as Record<string, any>)) {
1009
- if (!propSchema || typeof propSchema !== "object") continue;
1010
- if (propSchema.anyOf || propSchema.$ref) continue;
1011
-
1012
- const shouldWrap = isLoaderCompatibleProperty(propSchema);
1013
- if (!shouldWrap) continue;
1014
-
1015
- const { nullable, title, hide, ...rest } = propSchema;
1016
-
1017
- // Determine which loader refs to include based on property type
1018
- const loaderRefs = isProductArrayProperty(propSchema) ? productLoaderRefs : [];
1019
-
1020
- const wrapped: any = {
1021
- anyOf: [resolvableRef, { ...rest, title: title || "Inline data" }, ...loaderRefs],
1022
- };
1023
- if (nullable) wrapped.nullable = true;
1024
- if (title) wrapped.title = title;
1025
- if (hide) wrapped.hide = hide;
1026
-
1027
- def.properties[propName] = wrapped;
1028
- }
1029
-
1030
- // Also walk nested object properties (e.g., Tab.products inside tabs array items)
1031
- wrapNestedProperties(def, resolvableRef, productLoaderRefs);
1032
- }
1033
- }
1034
-
1035
- function isLoaderCompatibleProperty(schema: any): boolean {
1036
- if (schema.type === "array" && schema.items?.type === "object") {
1037
- const propCount = Object.keys(schema.items.properties || {}).length;
1038
- return propCount > 3;
1039
- }
1040
- return false;
1041
- }
1042
-
1043
- function isProductArrayProperty(schema: any): boolean {
1044
- if (schema.type !== "array" || !schema.items?.properties) return false;
1045
- const itemProps = schema.items.properties;
1046
- return !!(itemProps.productID || itemProps.name || itemProps.offers || itemProps.brand);
1047
- }
1048
-
1049
- /**
1050
- * Recursively walk nested object/array schemas to wrap deeply nested
1051
- * loader-compatible properties. Handles cases like Tab.products where
1052
- * the products field is inside an array item's object schema.
1053
- */
1054
- function wrapNestedProperties(
1055
- schema: any,
1056
- resolvableRef: any,
1057
- productLoaderRefs: any[],
1058
- depth = 0,
1059
- ) {
1060
- if (depth > 5 || !schema || typeof schema !== "object") return;
1061
-
1062
- if (schema.type === "array" && schema.items?.type === "object" && schema.items.properties) {
1063
- for (const [propName, propSchema] of Object.entries(
1064
- schema.items.properties as Record<string, any>,
1065
- )) {
1066
- if (!propSchema || typeof propSchema !== "object") continue;
1067
- if (propSchema.anyOf || propSchema.$ref) continue;
1068
-
1069
- if (isLoaderCompatibleProperty(propSchema)) {
1070
- const { nullable, title, hide, ...rest } = propSchema;
1071
- const loaderRefs = isProductArrayProperty(propSchema) ? productLoaderRefs : [];
1072
- const wrapped: any = {
1073
- anyOf: [resolvableRef, { ...rest, title: title || "Inline data" }, ...loaderRefs],
1074
- };
1075
- if (nullable) wrapped.nullable = true;
1076
- if (title) wrapped.title = title;
1077
- if (hide) wrapped.hide = hide;
1078
- schema.items.properties[propName] = wrapped;
1079
- }
1080
-
1081
- wrapNestedProperties(propSchema, resolvableRef, productLoaderRefs, depth + 1);
1082
- }
1083
- }
1084
-
1085
- if (schema.properties) {
1086
- for (const propSchema of Object.values(schema.properties)) {
1087
- wrapNestedProperties(propSchema as any, resolvableRef, productLoaderRefs, depth + 1);
1088
- }
1089
- }
1090
- }
1091
-
1092
- // ---------------------------------------------------------------------------
1093
- // composeMeta
1094
- // ---------------------------------------------------------------------------
1095
-
1096
- const SECTION_REF_DEF_KEY = "__SECTION_REF__";
1097
-
1098
- export interface ComposeMetaOptions {
1099
- /**
1100
- * Value written to the returned `framework` field. Defaults to
1101
- * "tanstack-start" for backward compatibility. Non-React stacks that compose
1102
- * a self-contained meta at generation time (e.g. Eitri) pass their own name.
1103
- */
1104
- framework?: string;
1105
- }
1106
-
1107
- export function composeMeta(siteMeta: MetaResponse, options?: ComposeMetaOptions): MetaResponse {
1108
- // Idempotency guard. composeMeta is NOT structurally idempotent — it appends
1109
- // the framework section refs to `root.sections.anyOf` (and `__SECTION_REF__`),
1110
- // so composing an already-composed meta a second time duplicates those refs.
1111
- // Since self-contained meta.gen.json is now baked at generation time (the CLI
1112
- // always composes before writing), the tanstack runtime re-runs composeMeta
1113
- // on the file it loads from disk. A composed meta always carries a `framework`
1114
- // field, which raw generateMeta() output never sets — use it as the sentinel
1115
- // and return the already-composed meta unchanged. Raw metas (framework unset,
1116
- // e.g. sites generated by an older CLI) still compose normally, so this stays
1117
- // backward compatible.
1118
- if (siteMeta.framework) {
1119
- return siteMeta;
1120
- }
1121
-
1122
- const siteAnyOf = siteMeta.schema?.root?.sections?.anyOf || [];
1123
-
1124
- // Build all framework components. Loaders first: the commerce SEO sections'
1125
- // `jsonLD` data-source picker references the loader union, and that union must
1126
- // include the site's OWN loaders. The runtime registry (loaderRegistry) is
1127
- // empty at generation time, so `buildLoaderDefinitions` alone yields just
1128
- // `Resolvable` — merge in the site's own loaders so loader-backed pickers have
1129
- // real options in the baked meta, not only at runtime.
1130
- //
1131
- // Seed from the site's loader UNION (`schema.root.loaders.anyOf`), NOT
1132
- // `manifest.blocks.loaders`: the generator keeps `@ignore`d loaders in the
1133
- // manifest (they still need a def) while withholding them from the union so
1134
- // they can't be picked — reading the manifest would resurrect them. This
1135
- // source is also already `{ $ref }`-shaped and only points at defs that exist
1136
- // (no dangling refs).
1137
- //
1138
- // TODO: `root.matchers`/`root.actions` have the same empty-union-at-gen-time
1139
- // gap; only loaders are merged here (commerce SEO scope). Generalize if a
1140
- // matcher/action picker ever needs baked options.
1141
- const loaders = buildLoaderDefinitions();
1142
- const siteLoaderRefs = (siteMeta.schema?.root?.loaders?.anyOf ?? []).filter(
1143
- (ref: any): ref is { $ref: string } => Boolean(ref) && typeof ref.$ref === "string",
1144
- );
1145
- const seenLoaderRefs = new Set<string>(loaders.loaderAnyOf.map((r: any) => r.$ref));
1146
- const loaderUnion = [
1147
- ...loaders.loaderAnyOf,
1148
- ...siteLoaderRefs.filter((r: { $ref: string }) => !seenLoaderRefs.has(r.$ref)),
1149
- ];
1150
-
1151
- const fwSections = buildFrameworkSections(siteAnyOf, loaderUnion);
1152
- const fullSectionAnyOf = [...siteAnyOf, ...fwSections.extraAnyOf];
1153
- const page = buildPageSchema(fullSectionAnyOf);
1154
- const actions = buildActionDefinitions();
1155
- const matchers = buildMatcherDefinitions();
1156
-
1157
- const sectionRefDef = { title: "Section", anyOf: fullSectionAnyOf };
1158
-
1159
- const resolvableDef = buildResolvableDefinition();
1160
-
1161
- // Merge all definitions.
1162
- // Priority (last wins): auto-registered empty schemas → framework sections/pages →
1163
- // site-generated schemas (meta.gen.json, with full loader props) → framework-critical keys.
1164
- // This ensures detailed site-generated schemas always win over auto-registered stubs.
1165
- const allDefinitions: Record<string, any> = {
1166
- ...loaders.definitions,
1167
- ...actions.definitions,
1168
- ...matchers.definitions,
1169
- ...fwSections.definitions,
1170
- ...page.definitions,
1171
- ...(siteMeta.schema?.definitions || {}),
1172
- [SECTION_REF_DEF_KEY]: sectionRefDef,
1173
- [RESOLVABLE_LITERAL_KEY]: resolvableDef,
1174
- [RESOLVABLE_B64_KEY]: resolvableDef,
1175
- };
1176
-
1177
- // Post-process: wrap complex section properties with Resolvable anyOf
1178
- wrapResolvableProperties(allDefinitions, loaders.definitions);
1179
-
1180
- return {
1181
- ...siteMeta,
1182
- framework: options?.framework ?? "tanstack-start",
1183
- manifest: {
1184
- blocks: {
1185
- ...(siteMeta.manifest?.blocks || {}),
1186
- sections: {
1187
- ...(siteMeta.manifest?.blocks?.sections || {}),
1188
- ...fwSections.manifestBlocks,
1189
- },
1190
- pages: {
1191
- ...(siteMeta.manifest?.blocks?.pages || {}),
1192
- ...page.manifestBlocks,
1193
- },
1194
- loaders: {
1195
- ...(siteMeta.manifest?.blocks?.loaders || {}),
1196
- ...loaders.manifestBlocks,
1197
- },
1198
- actions: {
1199
- ...(siteMeta.manifest?.blocks?.actions || {}),
1200
- ...actions.manifestBlocks,
1201
- },
1202
- matchers: {
1203
- ...(siteMeta.manifest?.blocks?.matchers || {}),
1204
- ...matchers.manifestBlocks,
1205
- },
1206
- },
1207
- },
1208
- schema: {
1209
- definitions: allDefinitions,
1210
- root: {
1211
- ...(siteMeta.schema?.root || {}),
1212
- sections: { anyOf: fullSectionAnyOf },
1213
- pages: { anyOf: page.rootAnyOf },
1214
- loaders: { anyOf: loaderUnion },
1215
- matchers: { anyOf: matchers.matcherAnyOf },
1216
- },
1217
- },
1218
- };
1219
- }