@selvajs/selva 4.21.0-beta.11 → 4.21.0-beta.13

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 (288) hide show
  1. package/build/adapter-node.js +2 -2
  2. package/build/client/_app/immutable/assets/0.DOeHn583.css +2 -0
  3. package/build/client/_app/immutable/assets/0.DOeHn583.css.br +0 -0
  4. package/build/client/_app/immutable/assets/0.DOeHn583.css.gz +0 -0
  5. package/build/client/_app/immutable/assets/rhino3dm.CWOyICcB.wasm +0 -0
  6. package/build/client/_app/immutable/assets/rhino3dm.CWOyICcB.wasm.br +0 -0
  7. package/build/client/_app/immutable/assets/rhino3dm.CWOyICcB.wasm.gz +0 -0
  8. package/build/client/_app/immutable/chunks/2rFska3d.js +1 -0
  9. package/build/client/_app/immutable/chunks/2rFska3d.js.br +1 -0
  10. package/build/client/_app/immutable/chunks/2rFska3d.js.gz +0 -0
  11. package/build/client/_app/immutable/chunks/{B3BHv1lE.js → 5M5n6ftO.js} +59 -58
  12. package/build/client/_app/immutable/chunks/5M5n6ftO.js.br +0 -0
  13. package/build/client/_app/immutable/chunks/5M5n6ftO.js.gz +0 -0
  14. package/build/client/_app/immutable/chunks/71J-lVIC.js +7 -0
  15. package/build/client/_app/immutable/chunks/71J-lVIC.js.br +0 -0
  16. package/build/client/_app/immutable/chunks/71J-lVIC.js.gz +0 -0
  17. package/build/client/_app/immutable/chunks/{Dqy8nTaG.js → BCbumNc2.js} +1 -1
  18. package/build/client/_app/immutable/chunks/BCbumNc2.js.br +0 -0
  19. package/build/client/_app/immutable/chunks/BCbumNc2.js.gz +0 -0
  20. package/build/client/_app/immutable/chunks/BEzPIk5e.js +1 -0
  21. package/build/client/_app/immutable/chunks/BEzPIk5e.js.br +0 -0
  22. package/build/client/_app/immutable/chunks/BEzPIk5e.js.gz +0 -0
  23. package/build/client/_app/immutable/chunks/B_4x1b7P.js +1 -0
  24. package/build/client/_app/immutable/chunks/B_4x1b7P.js.br +0 -0
  25. package/build/client/_app/immutable/chunks/B_4x1b7P.js.gz +0 -0
  26. package/build/client/_app/immutable/chunks/{BAhtiTKe.js → Bs2bQTgl.js} +1 -1
  27. package/build/client/_app/immutable/chunks/Bs2bQTgl.js.br +0 -0
  28. package/build/client/_app/immutable/chunks/Bs2bQTgl.js.gz +0 -0
  29. package/build/client/_app/immutable/chunks/{cUJB_11K.js → CzHxHvr2.js} +1 -1
  30. package/build/client/_app/immutable/chunks/CzHxHvr2.js.br +0 -0
  31. package/build/client/_app/immutable/chunks/CzHxHvr2.js.gz +0 -0
  32. package/build/client/_app/immutable/chunks/Db9exncB.js +1 -0
  33. package/build/client/_app/immutable/chunks/Db9exncB.js.br +0 -0
  34. package/build/client/_app/immutable/chunks/Db9exncB.js.gz +0 -0
  35. package/build/client/_app/immutable/chunks/{BEPlNI5E.js → FIoX_cjM.js} +1 -1
  36. package/build/client/_app/immutable/chunks/FIoX_cjM.js.br +0 -0
  37. package/build/client/_app/immutable/chunks/FIoX_cjM.js.gz +0 -0
  38. package/build/client/_app/immutable/chunks/{CmlXAF26.js → aBYenH6-.js} +1 -1
  39. package/build/client/_app/immutable/chunks/aBYenH6-.js.br +0 -0
  40. package/build/client/_app/immutable/chunks/aBYenH6-.js.gz +0 -0
  41. package/build/client/_app/immutable/entry/{app.B3im90t6.js → app.BP5swwM7.js} +2 -2
  42. package/build/client/_app/immutable/entry/app.BP5swwM7.js.br +0 -0
  43. package/build/client/_app/immutable/entry/app.BP5swwM7.js.gz +0 -0
  44. package/build/client/_app/immutable/nodes/{1.DWd6YbcT.js → 1.DmBjtFLw.js} +1 -1
  45. package/build/client/_app/immutable/nodes/1.DmBjtFLw.js.br +0 -0
  46. package/build/client/_app/immutable/nodes/1.DmBjtFLw.js.gz +0 -0
  47. package/build/client/_app/immutable/nodes/{2.bCPP2ncY.js → 2.CWOFnTAV.js} +1 -1
  48. package/build/client/_app/immutable/nodes/2.CWOFnTAV.js.br +0 -0
  49. package/build/client/_app/immutable/nodes/2.CWOFnTAV.js.gz +0 -0
  50. package/build/client/_app/immutable/nodes/{20.DI5Eri_M.js → 20.4vwwwrQ_.js} +1 -1
  51. package/build/client/_app/immutable/nodes/20.4vwwwrQ_.js.br +0 -0
  52. package/build/client/_app/immutable/nodes/20.4vwwwrQ_.js.gz +0 -0
  53. package/build/client/_app/immutable/nodes/21.C1xtue6U.js +1 -0
  54. package/build/client/_app/immutable/nodes/21.C1xtue6U.js.br +0 -0
  55. package/build/client/_app/immutable/nodes/21.C1xtue6U.js.gz +0 -0
  56. package/build/client/_app/immutable/nodes/{25.BRm8FzmQ.js → 25.DR2ojPn5.js} +22 -22
  57. package/build/client/_app/immutable/nodes/25.DR2ojPn5.js.br +0 -0
  58. package/build/client/_app/immutable/nodes/25.DR2ojPn5.js.gz +0 -0
  59. package/build/client/_app/immutable/nodes/{3.Ctd9OGCk.js → 3.GtVSkcEP.js} +1 -1
  60. package/build/client/_app/immutable/nodes/{3.Ctd9OGCk.js.br → 3.GtVSkcEP.js.br} +0 -0
  61. package/build/client/_app/immutable/nodes/3.GtVSkcEP.js.gz +0 -0
  62. package/build/client/_app/immutable/nodes/{30.B6pd-F-z.js → 30.Cd56Qv6o.js} +5 -6
  63. package/build/client/_app/immutable/nodes/30.Cd56Qv6o.js.br +0 -0
  64. package/build/client/_app/immutable/nodes/30.Cd56Qv6o.js.gz +0 -0
  65. package/build/client/_app/immutable/nodes/{5.BUX4zZQj.js → 5.wbpOzblK.js} +1 -1
  66. package/build/client/_app/immutable/nodes/5.wbpOzblK.js.br +0 -0
  67. package/build/client/_app/immutable/nodes/5.wbpOzblK.js.gz +0 -0
  68. package/build/client/_app/immutable/nodes/{6.BpjtFwPi.js → 6.B2HdJrZB.js} +1 -1
  69. package/build/client/_app/immutable/nodes/6.B2HdJrZB.js.br +0 -0
  70. package/build/client/_app/immutable/nodes/6.B2HdJrZB.js.gz +0 -0
  71. package/build/client/_app/immutable/nodes/{7.hBM6C-wN.js → 7.BuWU0YDv.js} +1 -1
  72. package/build/client/_app/immutable/nodes/7.BuWU0YDv.js.br +0 -0
  73. package/build/client/_app/immutable/nodes/7.BuWU0YDv.js.gz +0 -0
  74. package/build/client/_app/version.json +1 -1
  75. package/build/client/_app/version.json.br +0 -0
  76. package/build/client/_app/version.json.gz +0 -0
  77. package/build/runtime-meta.json +1 -1
  78. package/build/server/.vite/manifest.json +145 -137
  79. package/build/server/_app/immutable/assets/_layout.DOeHn583.css +2 -0
  80. package/build/server/_app/immutable/assets/rhino3dm.CWOyICcB.wasm +0 -0
  81. package/build/server/chunks/access.js +63 -48
  82. package/build/server/chunks/access.js.map +1 -1
  83. package/build/server/chunks/access2.server.js +1 -1
  84. package/build/server/chunks/api-errors.js +3 -3
  85. package/build/server/chunks/api.js +1 -1
  86. package/build/server/chunks/boot.server.js +1 -1
  87. package/build/server/chunks/bootHealth.server.js +1 -1
  88. package/build/server/chunks/create-project.js +1 -1
  89. package/build/server/chunks/delete-with-blobs.js +1 -1
  90. package/build/server/chunks/{schema-extraction.js → errors.js} +31 -24
  91. package/build/server/chunks/errors.js.map +1 -0
  92. package/build/server/chunks/grasshopper.js +17 -10
  93. package/build/server/chunks/grasshopper.js.map +1 -1
  94. package/build/server/chunks/handlers.js +82 -75
  95. package/build/server/chunks/handlers.js.map +1 -1
  96. package/build/server/chunks/http.js +1 -1
  97. package/build/server/chunks/http2.js +1 -1
  98. package/build/server/chunks/instance.js +3 -3
  99. package/build/server/chunks/instanceAdmins.server.js +2 -2
  100. package/build/server/chunks/internal.js +1 -1
  101. package/build/server/chunks/{keepalive-vtcjhAV3.js → keepalive-DbmLH4v1.js} +5 -4
  102. package/build/server/chunks/keepalive-DbmLH4v1.js.map +1 -0
  103. package/build/server/chunks/limits.js +1 -1
  104. package/build/server/chunks/liveSolve.server.js +1 -1
  105. package/build/server/chunks/localeContext.svelte.js +74 -0
  106. package/build/server/chunks/localeContext.svelte.js.map +1 -1
  107. package/build/server/chunks/{visibility.js → logging.js} +262 -3
  108. package/build/server/chunks/logging.js.map +1 -0
  109. package/build/server/chunks/openapi.js +1 -1
  110. package/build/server/chunks/ops.js +64 -1
  111. package/build/server/chunks/ops.js.map +1 -1
  112. package/build/server/chunks/package.js +1 -1
  113. package/build/server/chunks/package.js.map +1 -1
  114. package/build/server/chunks/presets.server.js +1 -1
  115. package/build/server/chunks/providers.server.js +448 -317
  116. package/build/server/chunks/providers.server.js.map +1 -1
  117. package/build/server/chunks/remote-definition.js +1 -1
  118. package/build/server/chunks/resolve-server.js +1 -1
  119. package/build/server/chunks/rhino3dm.js +5 -0
  120. package/build/server/chunks/rhino3dm.js.map +1 -0
  121. package/build/server/chunks/safe-url.js +2 -2
  122. package/build/server/chunks/schema.js +1 -1
  123. package/build/server/chunks/schema.js.map +1 -1
  124. package/build/server/chunks/selfUpdate.server.js +1 -1
  125. package/build/server/chunks/server-config-write.js +1 -1
  126. package/build/server/chunks/server2.js +5 -1
  127. package/build/server/chunks/server2.js.map +1 -1
  128. package/build/server/chunks/solve.server.js +5 -4
  129. package/build/server/chunks/solve.server.js.map +1 -1
  130. package/build/server/chunks/sveltekit.js +2 -2
  131. package/build/server/chunks/tokens.js +2 -2
  132. package/build/server/entries/endpoints/api/admin/compute/_server.ts.js +1 -1
  133. package/build/server/entries/endpoints/api/admin/compute/actions/_server.ts.js +1 -1
  134. package/build/server/entries/endpoints/api/admin/compute/status/_server.ts.js +1 -1
  135. package/build/server/entries/endpoints/api/admin/orgs/_id_/_server.ts.js +1 -1
  136. package/build/server/entries/endpoints/api/admin/orgs/_server.ts.js +2 -2
  137. package/build/server/entries/endpoints/api/admin/projects/_id_/_server.ts.js +1 -1
  138. package/build/server/entries/endpoints/api/admin/projects/_id_/grants/_grantId_/_server.ts.js +1 -1
  139. package/build/server/entries/endpoints/api/admin/projects/_id_/grants/_server.ts.js +1 -1
  140. package/build/server/entries/endpoints/api/admin/projects/_server.ts.js +1 -1
  141. package/build/server/entries/endpoints/api/admin/system/health/_server.ts.js +1 -1
  142. package/build/server/entries/endpoints/api/admin/system/throughput/_server.ts.js +1 -1
  143. package/build/server/entries/endpoints/api/admin/system/update/_server.ts.js +1 -1
  144. package/build/server/entries/endpoints/api/admin/users/_id_/_server.ts.js +1 -1
  145. package/build/server/entries/endpoints/api/admin/users/_id_/disable/_server.ts.js +1 -1
  146. package/build/server/entries/endpoints/api/admin/users/_server.ts.js +2 -2
  147. package/build/server/entries/endpoints/api/diag/throughput/_server.ts.js +1 -1
  148. package/build/server/entries/endpoints/api/files/_...path_/_server.ts.js +2 -3
  149. package/build/server/entries/endpoints/api/files/_...path_/_server.ts.js.map +1 -1
  150. package/build/server/entries/endpoints/api/v1/compute/_server.ts.js +1 -1
  151. package/build/server/entries/endpoints/api/v1/compute/schema/_server.ts.js +3 -3
  152. package/build/server/entries/endpoints/api/v1/definitions/_guid_/_server.ts.js +1 -1
  153. package/build/server/entries/endpoints/api/v1/definitions/_guid_/image/_server.ts.js +1 -1
  154. package/build/server/entries/endpoints/api/v1/definitions/_guid_/publish/_server.ts.js +1 -1
  155. package/build/server/entries/endpoints/api/v1/definitions/_guid_/schema/_server.ts.js +1 -1
  156. package/build/server/entries/endpoints/api/v1/definitions/_guid_/share-links/_linkId_/_server.ts.js +1 -1
  157. package/build/server/entries/endpoints/api/v1/definitions/_guid_/share-links/_server.ts.js +1 -1
  158. package/build/server/entries/endpoints/api/v1/definitions/_guid_/solve/_server.ts.js +1 -1
  159. package/build/server/entries/endpoints/api/v1/definitions/_guid_/versions/_server.ts.js +1 -1
  160. package/build/server/entries/endpoints/api/v1/definitions/_guid_/versions/_versionId_/_server.ts.js +1 -1
  161. package/build/server/entries/endpoints/api/v1/definitions/_guid_/versions/_versionId_/changes/_server.ts.js +1 -1
  162. package/build/server/entries/endpoints/api/v1/definitions/_guid_/versions/_versionId_/inventory/_server.ts.js +1 -1
  163. package/build/server/entries/endpoints/api/v1/definitions/_guid_/versions/_versionId_/schema/_server.ts.js +1 -1
  164. package/build/server/entries/endpoints/api/v1/definitions/_guid_/versions/_versionId_/scripts/_scriptId_/_server.ts.js +1 -1
  165. package/build/server/entries/endpoints/api/v1/definitions/_guid_/versions/check/_server.ts.js +1 -1
  166. package/build/server/entries/endpoints/api/v1/definitions/_server.ts.js +1 -1
  167. package/build/server/entries/endpoints/api/v1/me/_server.ts.js +1 -1
  168. package/build/server/entries/endpoints/api/v1/me/starred/_guid_/_server.ts.js +1 -1
  169. package/build/server/entries/endpoints/api/v1/me/token/_server.ts.js +1 -1
  170. package/build/server/entries/endpoints/api/v1/orgs/_orgId_/_server.ts.js +1 -1
  171. package/build/server/entries/endpoints/api/v1/orgs/_orgId_/assets/_kind_/_server.ts.js +1 -1
  172. package/build/server/entries/endpoints/api/v1/orgs/_orgId_/compute/_server.ts.js +1 -1
  173. package/build/server/entries/endpoints/api/v1/orgs/_orgId_/invites/_id_/_server.ts.js +1 -1
  174. package/build/server/entries/endpoints/api/v1/orgs/_orgId_/invites/_id_/resend/_server.ts.js +1 -1
  175. package/build/server/entries/endpoints/api/v1/orgs/_orgId_/invites/_server.ts.js +1 -1
  176. package/build/server/entries/endpoints/api/v1/orgs/_orgId_/members/_server.ts.js +1 -1
  177. package/build/server/entries/endpoints/api/v1/orgs/_orgId_/members/_userId_/_server.ts.js +1 -1
  178. package/build/server/entries/endpoints/api/v1/orgs/_orgId_/tokens/_server.ts.js +1 -1
  179. package/build/server/entries/endpoints/api/v1/orgs/_orgId_/tokens/_tokenId_/_server.ts.js +1 -1
  180. package/build/server/entries/endpoints/api/v1/projects/_id_/_server.ts.js +1 -1
  181. package/build/server/entries/endpoints/api/v1/projects/_id_/members/_server.ts.js +1 -1
  182. package/build/server/entries/endpoints/api/v1/projects/_id_/members/_userId_/_server.ts.js +1 -1
  183. package/build/server/entries/endpoints/api/v1/projects/_id_/reclaim/_server.ts.js +1 -1
  184. package/build/server/entries/endpoints/api/v1/projects/_server.ts.js +1 -1
  185. package/build/server/entries/endpoints/api/v1/solve/_solveId_/cancel/_server.ts.js +2 -2
  186. package/build/server/entries/endpoints/api/v1/solve-events/_server.ts.js +2 -2
  187. package/build/server/entries/endpoints/api/v1/solve-events/_solveId_/_server.ts.js +1 -1
  188. package/build/server/entries/endpoints/auth/email/callback/_server.ts.js +1 -1
  189. package/build/server/entries/endpoints/auth/supabase/callback/_server.ts.js +1 -1
  190. package/build/server/entries/endpoints/auth/supabase/start/_server.ts.js +1 -1
  191. package/build/server/entries/endpoints/mcp/_server.ts.js +14 -8
  192. package/build/server/entries/endpoints/mcp/_server.ts.js.map +1 -1
  193. package/build/server/entries/hooks.server.js +37 -3
  194. package/build/server/entries/hooks.server.js.map +1 -1
  195. package/build/server/entries/pages/accept-invite/_page.server.ts.js +1 -1
  196. package/build/server/entries/pages/admin/_page.server.ts.js +1 -1
  197. package/build/server/entries/pages/admin/organizations/_page.server.ts.js +4 -9
  198. package/build/server/entries/pages/admin/organizations/_page.server.ts.js.map +1 -1
  199. package/build/server/entries/pages/docs/api/_page.server.ts.js +1 -1
  200. package/build/server/entries/pages/library/_guid_/_page.server.ts.js +8 -7
  201. package/build/server/entries/pages/library/_guid_/_page.server.ts.js.map +1 -1
  202. package/build/server/entries/pages/library/_guid_/_page.svelte.js +9874 -3725
  203. package/build/server/entries/pages/library/_guid_/_page.svelte.js.map +1 -1
  204. package/build/server/entries/pages/library/_page.server.ts.js +1 -2
  205. package/build/server/entries/pages/library/_page.server.ts.js.map +1 -1
  206. package/build/server/entries/pages/oauth/authorize/_page.server.ts.js +2 -2
  207. package/build/server/entries/pages/projects/_page.server.ts.js +2 -2
  208. package/build/server/entries/pages/projects/_page.svelte.js +10 -4
  209. package/build/server/entries/pages/projects/_page.svelte.js.map +1 -1
  210. package/build/server/entries/pages/setup/_page.server.ts.js +1 -1
  211. package/build/server/entries/pages/team/_page.server.ts.js +1 -1
  212. package/build/server/entries/pages/team/_page.server.ts.js.map +1 -1
  213. package/build/server/entries/pages/team/members/_page.server.ts.js +4 -2
  214. package/build/server/entries/pages/team/members/_page.server.ts.js.map +1 -1
  215. package/build/server/entries/pages/team/members/_page.svelte.js +6 -5
  216. package/build/server/entries/pages/team/members/_page.svelte.js.map +1 -1
  217. package/build/server/entries/pages/team/projects/_page.server.ts.js +5 -12
  218. package/build/server/entries/pages/team/projects/_page.server.ts.js.map +1 -1
  219. package/build/server/entries/pages/team/reclaim/_page.server.ts.js +6 -13
  220. package/build/server/entries/pages/team/reclaim/_page.server.ts.js.map +1 -1
  221. package/build/server/manifest-full.js +1 -1
  222. package/build/server/manifest.js +1 -1
  223. package/build/server/nodes/0.js +2 -2
  224. package/build/server/nodes/1.js +1 -1
  225. package/build/server/nodes/2.js +1 -1
  226. package/build/server/nodes/20.js +1 -1
  227. package/build/server/nodes/21.js +1 -1
  228. package/build/server/nodes/25.js +1 -1
  229. package/build/server/nodes/3.js +1 -1
  230. package/build/server/nodes/30.js +1 -1
  231. package/build/server/nodes/5.js +1 -1
  232. package/build/server/nodes/6.js +1 -1
  233. package/build/server/nodes/7.js +1 -1
  234. package/build/server/server.js +1 -1
  235. package/package.json +13 -13
  236. package/templates/.env.example +18 -1
  237. package/build/client/_app/immutable/assets/0.DJ150bSr.css +0 -2
  238. package/build/client/_app/immutable/assets/0.DJ150bSr.css.br +0 -0
  239. package/build/client/_app/immutable/assets/0.DJ150bSr.css.gz +0 -0
  240. package/build/client/_app/immutable/chunks/B3BHv1lE.js.br +0 -0
  241. package/build/client/_app/immutable/chunks/B3BHv1lE.js.gz +0 -0
  242. package/build/client/_app/immutable/chunks/BAhtiTKe.js.br +0 -0
  243. package/build/client/_app/immutable/chunks/BAhtiTKe.js.gz +0 -0
  244. package/build/client/_app/immutable/chunks/BEPlNI5E.js.br +0 -0
  245. package/build/client/_app/immutable/chunks/BEPlNI5E.js.gz +0 -0
  246. package/build/client/_app/immutable/chunks/CmlXAF26.js.br +0 -0
  247. package/build/client/_app/immutable/chunks/CmlXAF26.js.gz +0 -0
  248. package/build/client/_app/immutable/chunks/DQbsDiDJ.js +0 -1
  249. package/build/client/_app/immutable/chunks/DQbsDiDJ.js.br +0 -1
  250. package/build/client/_app/immutable/chunks/DQbsDiDJ.js.gz +0 -0
  251. package/build/client/_app/immutable/chunks/DW5EJMC7.js +0 -1
  252. package/build/client/_app/immutable/chunks/DW5EJMC7.js.br +0 -0
  253. package/build/client/_app/immutable/chunks/DW5EJMC7.js.gz +0 -0
  254. package/build/client/_app/immutable/chunks/Dqy8nTaG.js.br +0 -0
  255. package/build/client/_app/immutable/chunks/Dqy8nTaG.js.gz +0 -0
  256. package/build/client/_app/immutable/chunks/cUJB_11K.js.br +0 -0
  257. package/build/client/_app/immutable/chunks/cUJB_11K.js.gz +0 -0
  258. package/build/client/_app/immutable/entry/app.B3im90t6.js.br +0 -0
  259. package/build/client/_app/immutable/entry/app.B3im90t6.js.gz +0 -0
  260. package/build/client/_app/immutable/nodes/1.DWd6YbcT.js.br +0 -0
  261. package/build/client/_app/immutable/nodes/1.DWd6YbcT.js.gz +0 -0
  262. package/build/client/_app/immutable/nodes/2.bCPP2ncY.js.br +0 -0
  263. package/build/client/_app/immutable/nodes/2.bCPP2ncY.js.gz +0 -0
  264. package/build/client/_app/immutable/nodes/20.DI5Eri_M.js.br +0 -0
  265. package/build/client/_app/immutable/nodes/20.DI5Eri_M.js.gz +0 -0
  266. package/build/client/_app/immutable/nodes/21.BI8SjY_r.js +0 -1
  267. package/build/client/_app/immutable/nodes/21.BI8SjY_r.js.br +0 -1
  268. package/build/client/_app/immutable/nodes/21.BI8SjY_r.js.gz +0 -0
  269. package/build/client/_app/immutable/nodes/25.BRm8FzmQ.js.br +0 -0
  270. package/build/client/_app/immutable/nodes/25.BRm8FzmQ.js.gz +0 -0
  271. package/build/client/_app/immutable/nodes/3.Ctd9OGCk.js.gz +0 -0
  272. package/build/client/_app/immutable/nodes/30.B6pd-F-z.js.br +0 -0
  273. package/build/client/_app/immutable/nodes/30.B6pd-F-z.js.gz +0 -0
  274. package/build/client/_app/immutable/nodes/5.BUX4zZQj.js.br +0 -0
  275. package/build/client/_app/immutable/nodes/5.BUX4zZQj.js.gz +0 -0
  276. package/build/client/_app/immutable/nodes/6.BpjtFwPi.js.br +0 -0
  277. package/build/client/_app/immutable/nodes/6.BpjtFwPi.js.gz +0 -0
  278. package/build/client/_app/immutable/nodes/7.hBM6C-wN.js.br +0 -0
  279. package/build/client/_app/immutable/nodes/7.hBM6C-wN.js.gz +0 -0
  280. package/build/server/_app/immutable/assets/_layout.DJ150bSr.css +0 -2
  281. package/build/server/chunks/definitions.js +0 -263
  282. package/build/server/chunks/definitions.js.map +0 -1
  283. package/build/server/chunks/keepalive-vtcjhAV3.js.map +0 -1
  284. package/build/server/chunks/schema-extraction.js.map +0 -1
  285. package/build/server/chunks/visibility.js.map +0 -1
  286. /package/build/client/_app/immutable/nodes/{0.Bu9WQ0W_.js → 0.CXQcjMDK.js} +0 -0
  287. /package/build/client/_app/immutable/nodes/{0.Bu9WQ0W_.js.br → 0.CXQcjMDK.js.br} +0 -0
  288. /package/build/client/_app/immutable/nodes/{0.Bu9WQ0W_.js.gz → 0.CXQcjMDK.js.gz} +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"file":"definitions.js","names":[],"sources":["../../../../server/src/logging/PinoLogger.ts","../../../../server/src/logging/requestId.ts"],"sourcesContent":["import type { ILogger, LogFields, LogLevel } from '@selvajs/platform';\n\n/**\n * `ILogger` backed by pino, with a console-backed fallback.\n *\n * pino is an OPTIONAL peer dependency, imported dynamically so the base install\n * ships without it. Unlike `@sentry/node` next door, absence must NOT degrade to\n * silence — an operator who never configured a logging backend still needs\n * warnings and errors on stdout, so {@link createLogger} falls back to\n * {@link ConsoleLogger} rather than returning `null`.\n *\n * pino earns its place by writing newline-delimited JSON with a stable schema:\n * what every log collector expects, and what console template literals can't\n * produce.\n */\n\n/** The slice of pino's surface used here — a hard import would make it mandatory. */\ninterface PinoLike {\n\tdebug(obj: object, msg?: string): void;\n\tinfo(obj: object, msg?: string): void;\n\twarn(obj: object, msg?: string): void;\n\terror(obj: object, msg?: string): void;\n\tchild(bindings: object): PinoLike;\n}\n\ntype PinoFactory = (options: {\n\tlevel: string;\n\tbase: object | undefined;\n\tredact?: { paths: string[]; censor: string };\n\ttransport?: { target: string; options: object };\n}) => PinoLike;\n\n/**\n * Field names scrubbed before a record is written, by both backends. A backstop\n * for accidents, NOT a licence to log objects: call sites are required not to\n * log secrets in the first place (see `LogFields`). This catches the case where\n * a whole object is spread into fields and happens to carry a credential.\n *\n * It matches by FIELD NAME, and only at the top level or one level deep. It will\n * not catch personal data: an email nested in a payload sails straight through,\n * and a log line reaches a collector that erasure can never reach.\n */\nconst REDACTED_KEYS = [\n\t'token',\n\t'sessionToken',\n\t'refreshToken',\n\t'apiKey',\n\t'api_key',\n\t'password',\n\t'authorization',\n\t'Authorization',\n\t'cookie',\n\t// A freshly minted API token is returned as `secret`.\n\t'secret'\n];\n\nconst CENSOR = '[redacted]';\nconst REDACTED = new Set(REDACTED_KEYS);\nconst REDACTED_PATHS = [...REDACTED_KEYS, ...REDACTED_KEYS.map((k) => `*.${k}`)];\n\n/** {@link REDACTED_KEYS} applied the way pino applies its paths, on a copy. */\nfunction redact(fields: LogFields): LogFields {\n\tconst out: LogFields = {};\n\tfor (const [key, value] of Object.entries(fields)) {\n\t\tout[key] = REDACTED.has(key) ? CENSOR : redactOneLevel(value);\n\t}\n\treturn out;\n}\n\nfunction redactOneLevel(value: unknown): unknown {\n\tif (value === null || typeof value !== 'object' || Array.isArray(value)) return value;\n\tif (!Object.keys(value).some((k) => REDACTED.has(k))) return value;\n\treturn Object.fromEntries(\n\t\tObject.entries(value).map(([k, v]) => [k, REDACTED.has(k) ? CENSOR : v])\n\t);\n}\n\n/**\n * Minimal `ILogger` over `console.*`, used when pino isn't installed. Renders\n * as `LEVEL message {fields}` — greppable, and honest about not being\n * machine-parseable. `child` fields merge eagerly so correlation still works.\n */\nexport class ConsoleLogger implements ILogger {\n\tconstructor(\n\t\tprivate readonly bound: LogFields = {},\n\t\tprivate readonly minLevel: LogLevel = 'info'\n\t) {}\n\n\tprivate static readonly ORDER: Record<LogLevel, number> = {\n\t\tdebug: 10,\n\t\tinfo: 20,\n\t\twarn: 30,\n\t\terror: 40\n\t};\n\n\tprivate write(level: LogLevel, message: string, fields?: LogFields): void {\n\t\tif (ConsoleLogger.ORDER[level] < ConsoleLogger.ORDER[this.minLevel]) return;\n\t\tconst merged = { ...this.bound, ...fields };\n\t\tconst suffix = Object.keys(merged).length > 0 ? ` ${renderFields(merged)}` : '';\n\t\tconst line = `${level.toUpperCase()} ${message}${suffix}`;\n\t\t// Split stderr/stdout the way an operator expects. `info` carries debug\n\t\t// too — both land on stdout, and the line already spells out its level.\n\t\tif (level === 'error') console.error(line);\n\t\telse if (level === 'warn') console.warn(line);\n\t\telse console.info(line);\n\t}\n\n\tdebug(message: string, fields?: LogFields): void {\n\t\tthis.write('debug', message, fields);\n\t}\n\tinfo(message: string, fields?: LogFields): void {\n\t\tthis.write('info', message, fields);\n\t}\n\twarn(message: string, fields?: LogFields): void {\n\t\tthis.write('warn', message, fields);\n\t}\n\terror(message: string, fields?: LogFields): void {\n\t\tthis.write('error', message, fields);\n\t}\n\tchild(fields: LogFields): ILogger {\n\t\treturn new ConsoleLogger({ ...this.bound, ...fields }, this.minLevel);\n\t}\n}\n\n/** Fields can hold anything, including cycles. Never let rendering throw. */\nfunction renderFields(fields: LogFields): string {\n\ttry {\n\t\treturn JSON.stringify(redact(fields)) ?? String(fields);\n\t} catch {\n\t\treturn '[unserializable]';\n\t}\n}\n\nclass PinoLogger implements ILogger {\n\tconstructor(private readonly pino: PinoLike) {}\n\n\t// pino takes (fields, message); ILogger takes (message, fields). The flip is\n\t// deliberate — the message is what a human scans for first.\n\tdebug(message: string, fields?: LogFields): void {\n\t\ttry {\n\t\t\tthis.pino.debug(fields ?? {}, message);\n\t\t} catch {\n\t\t\t/* logging must never throw */\n\t\t}\n\t}\n\tinfo(message: string, fields?: LogFields): void {\n\t\ttry {\n\t\t\tthis.pino.info(fields ?? {}, message);\n\t\t} catch {\n\t\t\t/* logging must never throw */\n\t\t}\n\t}\n\twarn(message: string, fields?: LogFields): void {\n\t\ttry {\n\t\t\tthis.pino.warn(fields ?? {}, message);\n\t\t} catch {\n\t\t\t/* logging must never throw */\n\t\t}\n\t}\n\terror(message: string, fields?: LogFields): void {\n\t\ttry {\n\t\t\tthis.pino.error(fields ?? {}, message);\n\t\t} catch {\n\t\t\t/* logging must never throw */\n\t\t}\n\t}\n\tchild(fields: LogFields): ILogger {\n\t\ttry {\n\t\t\treturn new PinoLogger(this.pino.child(fields));\n\t\t} catch {\n\t\t\treturn this;\n\t\t}\n\t}\n}\n\nexport interface CreateLoggerOptions {\n\t/** Minimum level written; records below it are dropped. Defaults to `info`. */\n\tlevel?: LogLevel;\n\t/**\n\t * Pretty-print via `pino-pretty` instead of JSON — for local development;\n\t * production wants JSON for the collector. Asking for this without\n\t * `pino-pretty` installed drops the whole logger to {@link ConsoleLogger}.\n\t */\n\tpretty?: boolean;\n\t/** Fields stamped on every record (e.g. service name, release). */\n\tbase?: LogFields;\n}\n\n/** Build the app's root logger. Never throws, never returns `null`. */\nexport async function createLogger(opts: CreateLoggerOptions = {}): Promise<ILogger> {\n\tconst level = opts.level ?? 'info';\n\ttry {\n\t\tconst factory = await loadPinoFactory();\n\t\tif (!factory) return new ConsoleLogger(opts.base ?? {}, level);\n\t\tconst pino = factory({\n\t\t\tlevel,\n\t\t\tbase: opts.base,\n\t\t\tredact: { paths: REDACTED_PATHS, censor: CENSOR },\n\t\t\ttransport: opts.pretty\n\t\t\t\t? { target: 'pino-pretty', options: { colorize: true, ignore: 'pid,hostname' } }\n\t\t\t\t: undefined\n\t\t});\n\t\treturn new PinoLogger(pino);\n\t} catch (err) {\n\t\t// pino resolved but wouldn't construct — a real misconfiguration (e.g.\n\t\t// `pretty: true` with pino-pretty absent). Worth complaining about, unlike\n\t\t// a merely absent package: the operator asked for something they didn't get.\n\t\tconsole.warn(\n\t\t\t`[Logger] pino was found but could not be initialized; falling back to console logging. ${String(err)}`\n\t\t);\n\t\treturn new ConsoleLogger(opts.base ?? {}, level);\n\t}\n}\n\n/**\n * Load pino's factory, or `null` when it isn't installed.\n *\n * Don't inline the specifier. A literal `import('pino')` is statically\n * analyzable, so Vite applied browser-field mapping to this server build and\n * resolved it to pino's `server_false` browser shim — a stub whose factory\n * throws, turning \"use pino\" into a silent fall back to the console. Computing\n * the specifier defeats that and leaves the import to Node at runtime.\n * `@vite-ignore` alone was NOT enough: it silenced the warning and the rewrite\n * still happened.\n */\nasync function loadPinoFactory(): Promise<PinoFactory | null> {\n\tconst specifier = 'pino';\n\ttry {\n\t\tconst mod = await import(/* @vite-ignore */ specifier);\n\t\tconst factory = ((mod as { default?: unknown }).default ?? mod) as PinoFactory;\n\t\treturn typeof factory === 'function' ? factory : null;\n\t} catch {\n\t\t// Not installed — the expected path on a base install, where the console\n\t\t// fallback is intended. Quiet on purpose: complaining at boot about an\n\t\t// optional package nobody asked for is noise.\n\t\treturn null;\n\t}\n}\n","/**\n * Request-id resolution for log correlation. Every record on a request path\n * carries the same `requestId`, so an operator handed one id can reconstruct\n * that request's whole story.\n *\n * Inbound ids are TRUSTED when present. Selva runs behind a reverse proxy\n * (Caddy/nginx) that mints a request id for its own access logs; minting a\n * second one here would split one request across two ids and kill cross-tier\n * correlation. The trade — a direct caller picks their own id — is fine, because\n * the id is only ever a log field and an echoed response header, never an\n * authorization or uniqueness input.\n *\n * That trust is why {@link sanitizeRequestId} exists: an attacker-chosen id is\n * untrusted content. Unbounded or newline-carrying values would let a caller\n * forge log lines (log injection) or bloat every record on the request.\n */\n\n/** Header carrying a caller/proxy-supplied id. The de-facto standard spelling. */\nexport const REQUEST_ID_HEADER = 'x-request-id';\n\n/** Long enough for a UUID or a W3C trace-id, short enough to bound a record. */\nconst MAX_REQUEST_ID_LENGTH = 128;\n\n/**\n * Characters allowed through verbatim. Strict on purpose: UUIDs, ULIDs, hex\n * trace-ids and nginx's `$request_id` all fit. Everything else — whitespace,\n * control chars, quotes, CR/LF — is dropped rather than escaped, since no\n * legitimate id needs them and dropping can't be un-escaped downstream.\n */\nconst UNSAFE_REQUEST_ID_CHARS = /[^A-Za-z0-9._:-]/g;\n\n/** Returns `null` when nothing usable survives, so the caller generates instead. */\nexport function sanitizeRequestId(raw: string | null | undefined): string | null {\n\tif (!raw) return null;\n\tconst cleaned = raw.replace(UNSAFE_REQUEST_ID_CHARS, '').slice(0, MAX_REQUEST_ID_LENGTH);\n\treturn cleaned.length > 0 ? cleaned : null;\n}\n\n/**\n * Reuse the proxy's id when it survives sanitization, otherwise mint a UUID.\n *\n * @param generate injectable so tests get deterministic ids\n */\nexport function resolveRequestId(headers: Headers, generate: () => string = randomId): string {\n\treturn sanitizeRequestId(headers.get(REQUEST_ID_HEADER)) ?? generate();\n}\n\n/**\n * Render a thrown value into a log field.\n *\n * Not every rejection is an `Error` — provider adapters sometimes reject with a\n * plain `{ message, status }`, which would stringify to a useless\n * `[object Object]` and destroy the only record of the failure. Errors keep\n * their stack; anything else is JSON-serialized, with `String()` as the last\n * resort for cycles and exotic values.\n *\n * A `code` / `statusCode` carried on the error (ComputeError, ProviderError,\n * Node's ECONNREFUSED-style errors) is appended as a `[code=… status=…]` tag —\n * it classifies the failure and stacks alone don't show it.\n */\nexport function renderThrown(error: unknown): string {\n\tif (error instanceof Error) {\n\t\tconst base = error.stack ?? error.message;\n\t\tconst code = (error as { code?: unknown }).code;\n\t\tconst statusCode = (error as { statusCode?: unknown }).statusCode;\n\t\tconst tags: string[] = [];\n\t\tif (typeof code === 'string' || typeof code === 'number') tags.push(`code=${code}`);\n\t\tif (typeof statusCode === 'number') tags.push(`status=${statusCode}`);\n\t\treturn tags.length > 0 ? `${base} [${tags.join(' ')}]` : base;\n\t}\n\ttry {\n\t\treturn JSON.stringify(error) ?? String(error);\n\t} catch {\n\t\treturn String(error);\n\t}\n}\n\n/**\n * `crypto.randomUUID` exists in every runtime Selva targets (Node 22+, workers,\n * modern browsers); the `Math.random` branch only covers non-secure contexts\n * where it is missing. Not a weakness: these ids need to be collision-free\n * enough to correlate logs, never unguessable.\n */\nfunction randomId(): string {\n\tconst c: Crypto | undefined = globalThis.crypto;\n\tif (c && typeof c.randomUUID === 'function') return c.randomUUID();\n\treturn `req-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;\n}\n"],"mappings":";;;;;;;;;;;;AA0CA,IAAM,gBAAgB;CACrB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;AACD;AAEA,IAAM,SAAS;AACf,IAAM,WAAW,IAAI,IAAI,aAAa;AACtC,IAAM,iBAAiB,CAAC,GAAG,eAAe,GAAG,cAAc,KAAK,MAAM,KAAK,GAAG,CAAC;;AAG/E,SAAS,OAAO,QAA8B;CAC7C,MAAM,MAAiB,CAAC;CACxB,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,MAAM,GAC/C,IAAI,OAAO,SAAS,IAAI,GAAG,IAAI,SAAS,eAAe,KAAK;CAE7D,OAAO;AACR;AAEA,SAAS,eAAe,OAAyB;CAChD,IAAI,UAAU,QAAQ,OAAO,UAAU,YAAY,MAAM,QAAQ,KAAK,GAAG,OAAO;CAChF,IAAI,CAAC,OAAO,KAAK,KAAK,CAAC,CAAC,MAAM,MAAM,SAAS,IAAI,CAAC,CAAC,GAAG,OAAO;CAC7D,OAAO,OAAO,YACb,OAAO,QAAQ,KAAK,CAAC,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,GAAG,SAAS,IAAI,CAAC,IAAI,SAAS,CAAC,CAAC,CACxE;AACD;;;;;;AAOA,IAAa,gBAAb,MAAa,cAAiC;CAE3B;CACA;CAFlB,YACC,QAAoC,CAAC,GACrC,WAAsC,QACrC;EAFgB,KAAA,QAAA;EACA,KAAA,WAAA;CACf;CAEH,OAAwB,QAAkC;EACzD,OAAO;EACP,MAAM;EACN,MAAM;EACN,OAAO;CACR;CAEA,MAAc,OAAiB,SAAiB,QAA0B;EACzE,IAAI,cAAc,MAAM,SAAS,cAAc,M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,OAAO,QAAQ,SAAS,IAAI,UAAU;AACvC;;;;;;AAOA,SAAgB,iBAAiB,SAAkB,WAAyB,UAAkB;CAC7F,OAAO,kBAAkB,QAAQ,IAAA,cAAqB,CAAC,KAAK,SAAS;AACtE;;;;;;;;;;;;;;AAeA,SAAgB,aAAa,OAAwB;CACpD,IAAI,iBAAiB,OAAO;EAC3B,MAAM,OAAO,MAAM,SAAS,MAAM;EAClC,MAAM,OAAQ,MAA6B;EAC3C,MAAM,aAAc,MAAmC;EACvD,MAAM,OAAiB,CAAC;EACxB,IAAI,OAAO,SAAS,YAAY,OAAO,SAAS,UAAU,KAAK,KAAK,QAAQ,MAAM;EAClF,IAAI,OAAO,eAAe,UAAU,KAAK,KAAK,UAAU,YAAY;EACpE,OAAO,KAAK,SAAS,IAAI,GAAG,KAAK,IAAI,KAAK,KAAK,GAAG,EAAE,KAAK;CAC1D;CACA,IAAI;EACH,OAAO,KAAK,UAAU,KAAK,KAAK,OAAO,KAAK;CAC7C,QAAQ;EACP,OAAO,OAAO,KAAK;CACpB;AACD;;;;;;;AAQA,SAAS,WAAmB;CAC3B,MAAM,IAAwB,WAAW;CACzC,IAAI,KAAK,OAAO,EAAE,eAAe,YAAY,OAAO,EAAE,WAAW;CACjE,OAAO,OAAO,KAAK,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,GAAG,KAAK,OAAO,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,MAAM,GAAG,EAAE;AAChF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"keepalive-vtcjhAV3.js","names":[],"sources":["../../../../solve/dist/keepalive-vtcjhAV3.js"],"sourcesContent":["import { getInputItems } from \"@selvajs/schemas\";\n// src/shared/server-sourced.ts\n/**\n* Inputs the schema marks `source.kind === 'server'`. No resolver fills them, so they solve with\n* their schema default: the client sends no value for them, and the server refuses one.\n*/\nfunction serverSourcedInputIds(schema) {\n\treturn new Set(getInputItems(schema).filter((item) => item.source?.kind === \"server\").map((item) => item.paramId));\n}\n// src/shared/abort.ts\n/** `promise`'s outcome, or a rejection with `signal`'s reason if that fires first. */\nfunction raceAbort(promise, signal) {\n\treturn new Promise((resolve, reject) => {\n\t\tconst onAbort = () => reject(signal.reason);\n\t\tif (signal.aborted) onAbort();\n\t\tsignal.addEventListener(\"abort\", onAbort, { once: true });\n\t\tpromise.then(resolve, reject).finally(() => signal.removeEventListener(\"abort\", onAbort));\n\t});\n}\n// src/shared/keepalive.ts\nconst KEEPALIVE_PREFERENCE = \"selva-keepalive\";\n/** Under the 30 s many load balancers allow an idle upstream. */\nconst KEEPALIVE_INTERVAL_MS = 15e3;\nexport { serverSourcedInputIds as i, KEEPALIVE_PREFERENCE as n, raceAbort as r, KEEPALIVE_INTERVAL_MS as t };\n\n//# sourceMappingURL=keepalive-vtcjhAV3.js.map"],"mappings":";;;;;;AAMA,SAAS,sBAAsB,QAAQ;CACtC,OAAO,IAAI,IAAI,cAAc,MAAM,CAAC,CAAC,QAAQ,SAAS,KAAK,QAAQ,SAAS,QAAQ,CAAC,CAAC,KAAK,SAAS,KAAK,OAAO,CAAC;AAClH;;AAGA,SAAS,UAAU,SAAS,QAAQ;CACnC,OAAO,IAAI,SAAS,SAAS,WAAW;EACvC,MAAM,gBAAgB,OAAO,OAAO,MAAM;EAC1C,IAAI,OAAO,SAAS,QAAQ;EAC5B,OAAO,iBAAiB,SAAS,SAAS,EAAE,MAAM,KAAK,CAAC;EACxD,QAAQ,KAAK,SAAS,MAAM,CAAC,CAAC,cAAc,OAAO,oBAAoB,SAAS,OAAO,CAAC;CACzF,CAAC;AACF;AAEA,IAAM,uBAAuB;;AAE7B,IAAM,wBAAwB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema-extraction.js","names":["readWrapper"],"sources":["../../../../server/src/compute/errors.ts","../../../../server/src/definitions/saved-values.ts","../../../../server/src/definitions/with-timeout.ts","../../../../server/src/definitions/schema-extraction.ts"],"sourcesContent":["/**\n * Compute error types, kept in a leaf module with no imports.\n *\n * Separate from the function that throws them on purpose: an error mapper needs\n * nothing but the class to `instanceof` against, and importing it from beside\n * the throw site drags that module's dependencies into every mapper. Anything\n * an error mapper imports belongs here.\n */\n\n/**\n * Thrown when no compute server is configured or visible for the org — a\n * misconfiguration an operator must fix in `/admin/compute`, not a bug. Routes\n * map this to 503 instead of letting the pure helper's plain `Error` surface as\n * a generic 500.\n */\nexport class ComputeServerUnconfiguredError extends Error {\n\tconstructor(\n\t\tmessage = 'No compute server configured. Ask an admin to add one in /admin/compute.'\n\t) {\n\t\tsuper(message);\n\t\tthis.name = 'ComputeServerUnconfiguredError';\n\t}\n}\n","// The embedded schema carries input values from the author's last schema sync. Compute's `/io`\n// reads the values saved in the file, which can be newer, and those are what a form must start\n// from. A version's bytes never change, so neither do its saved values.\n\nimport type { UISchema } from '@selvajs/schemas';\n\n/** Each input's saved value, keyed by param id. */\nexport type SavedValues = ReadonlyMap<string, unknown>;\n\nexport function savedValuesFrom(\n\tinputs: ReadonlyArray<{ id?: string; paramType?: string; default?: unknown }>\n): SavedValues {\n\tconst values = new Map<string, unknown>();\n\tfor (const input of inputs) {\n\t\tif (input.id === undefined || input.default === undefined) continue;\n\t\tvalues.set(input.id, input.paramType === 'Color' ? colorToHex(input.default) : input.default);\n\t}\n\treturn values;\n}\n\n/** `schema` with each input's `default` replaced by its saved value, where it has one. */\nexport function applySavedValues(schema: UISchema, values: SavedValues): UISchema {\n\treturn {\n\t\t...schema,\n\t\tinputs: schema.inputs.map((input) =>\n\t\t\tvalues.has(input.id) ? { ...input, default: values.get(input.id) } : input\n\t\t)\n\t};\n}\n\n// Compute sends colors as \"r,g,b\" or \"a,r,g,b\"; the color picker takes hex.\nfunction colorToHex(value: unknown): unknown {\n\tconst parts = String(value)\n\t\t.split(',')\n\t\t.map((s) => parseInt(s.trim(), 10));\n\tconst hex = (n: number) => n.toString(16).padStart(2, '0');\n\tif (parts.length === 3) return `#${hex(parts[0])}${hex(parts[1])}${hex(parts[2])}`;\n\tif (parts.length === 4) return `#${hex(parts[1])}${hex(parts[2])}${hex(parts[3])}`;\n\treturn value;\n}\n","/**\n * Settles with `work`, or rejects with `onTimeout()` after `ms`. `work` is not cancelled: it runs\n * on, and its later rejection stays handled.\n */\nexport function withTimeout<T>(work: Promise<T>, ms: number, onTimeout: () => Error): Promise<T> {\n\tlet timer: ReturnType<typeof setTimeout> | undefined;\n\tconst timeout = new Promise<never>((_, reject) => {\n\t\ttimer = setTimeout(() => reject(onTimeout()), ms);\n\t});\n\treturn Promise.race([work, timeout]).finally(() => clearTimeout(timer));\n}\n","// Extraction IS validation: a `.gh` with no valid \"Schema\" output, or an\n// unreachable compute server, throws here — which is what makes this the upload\n// gate as well as the render path's fallback for un-cached or stale versions.\n\nimport {\n\tfetchParsedDefinitionIO,\n\tnormalizeUISchemaCasing,\n\treadSchemaResults as readWrapper,\n\ttype SchemaEndpointResult\n} from '@selvajs/compute/grasshopper';\nimport {\n\tUI_SCHEMA_VERSION,\n\ttype DocumentInventory,\n\ttype ScriptSource,\n\ttype UISchema\n} from '@selvajs/schemas';\nimport type { ComputeServerConfig } from '@selvajs/platform';\nimport { applySavedValues, savedValuesFrom } from './saved-values.js';\nimport { withTimeout } from './with-timeout.js';\n\n/** One entry of the compute schema endpoint's response, typed to our `UISchema`. */\nexport type SchemaExtractionResult = SchemaEndpointResult<UISchema>;\n\n/** Thin re-export of @selvajs/compute's unwrap, typed to `UISchema`. */\nexport function readSchemaResults(raw: unknown): SchemaExtractionResult[] {\n\treturn readWrapper<UISchema>(raw);\n}\n\n/** Thrown when compute is reachable but the definition yields no usable schema. */\nexport class SchemaExtractionError extends Error {\n\tconstructor(\n\t\tpublic readonly kind: 'unreachable' | 'invalid' | 'unsupported' | 'malformed',\n\t\tmessage: string\n\t) {\n\t\tsuper(message);\n\t\tthis.name = 'SchemaExtractionError';\n\t}\n}\n\n/**\n * Rejects a schema whose keys are not camelCase by the time it reaches a consumer.\n *\n * Compute serializes the plugin's `UISchema` POCO, whose camelCase names live in\n * `[JsonProperty]` attributes. `Selva.gha` ILRepack-merges Newtonsoft, so those\n * attributes have type `Selva!Newtonsoft.Json.JsonPropertyAttribute`; a compute\n * server serializing with its OWN Newtonsoft does not recognize them, reads no\n * attributes, and falls back to raw CLR member names — `Inputs`, `Layout`.\n * Nothing throws on the wire: every consumer just reads `schema.inputs` as\n * undefined and renders a definition with no inputs.\n *\n * `postSchemaFormData` repairs that casing via `normalizeUISchemaCasing`, so a\n * schema fresh off the wire never trips this. It stays because schemas are also\n * PERSISTED: a row cached before the normalizer existed still holds PascalCase,\n * and it reaches consumers without passing through `postSchemaFormData` again.\n * A schema with no `inputs` in any casing lands here too. It is a backstop, not\n * the primary defense — which is why it names the missing key rather than telling\n * the operator to go update their compute server.\n *\n * Checked structurally rather than by plugin version, because the casing depends\n * on which assembly serialized the schema, not on any version number.\n */\nexport function assertCamelCaseSchema(schema: UISchema): void {\n\tconst raw = schema as unknown as Record<string, unknown>;\n\tif (Array.isArray(raw.inputs)) return;\n\n\tconst pascalKeys = ['Inputs', 'Outputs', 'Layout', 'SchemaVersion'].filter((k) => k in raw);\n\tif (pascalKeys.length > 0) {\n\t\tthrow new SchemaExtractionError(\n\t\t\t'malformed',\n\t\t\t`Schema keys are PascalCase (found ${pascalKeys.join(', ')}), so every property name ` +\n\t\t\t\t`is wrong and the definition would render with no inputs. Compute serialized it with ` +\n\t\t\t\t`its own Newtonsoft instead of the one merged into Selva.gha. Fresh responses are ` +\n\t\t\t\t`normalized, so this is most likely a schema cached before that fix — re-save the ` +\n\t\t\t\t`definition version to re-extract it.`\n\t\t);\n\t}\n\n\tthrow new SchemaExtractionError(\n\t\t'malformed',\n\t\t`Compute returned a schema with no 'inputs' array (got keys: ${Object.keys(raw)\n\t\t\t.slice(0, 12)\n\t\t\t.join(', ')}).`\n\t);\n}\n\nfunction parseSemver(version: string): [number, number, number] | null {\n\tconst m = /^(\\d+)\\.(\\d+)\\.(\\d+)$/.exec(version);\n\treturn m ? [Number(m[1]), Number(m[2]), Number(m[3])] : null;\n}\n\n/**\n * Orders a schema format version against the app's `UI_SCHEMA_VERSION`: -1 older, 0 current,\n * 1 newer, null unparseable. A missing version is older: plugins before 2.12.0 emitted none.\n */\nexport function compareSchemaVersion(version: string | undefined): -1 | 0 | 1 | null {\n\tif (!version) return -1;\n\tconst extracted = parseSemver(version);\n\tconst supported = parseSemver(UI_SCHEMA_VERSION);\n\tif (!extracted || !supported) return null;\n\tfor (let i = 0; i < 3; i++) {\n\t\tif (extracted[i] !== supported[i]) return extracted[i] < supported[i] ? -1 : 1;\n\t}\n\treturn 0;\n}\n\n/**\n * Rejects a schema from a NEWER plugin than this app was built against — its\n * shape may contain constructs the renderer doesn't know. Older (or missing)\n * versions pass: the compute-side C# migrator always emits its own current\n * version, and an older shape only lacks optional additions.\n */\nexport function assertSupportedSchemaVersion(schema: UISchema): void {\n\tif (compareSchemaVersion(schema.schemaVersion) === 1) {\n\t\tthrow new SchemaExtractionError(\n\t\t\t'unsupported',\n\t\t\t`This definition was authored with a newer Selva plugin (schema format ${schema.schemaVersion}); ` +\n\t\t\t\t`this server supports schema format ≤ ${UI_SCHEMA_VERSION}. Update the server, or ` +\n\t\t\t\t`re-save the definition with a matching plugin version.`\n\t\t);\n\t}\n}\n\n/**\n * POSTs a multipart form to Rhino Compute's `/grasshopper/schema` endpoint (no\n * solve required). Throws 'unreachable' on a network failure or non-2xx. The\n * per-file `error` Compute reports on its 200-with-no-schemas case is left to\n * the caller — single-file and multi-file callers want different messages.\n */\nexport async function postSchemaFormData(\n\tformData: FormData,\n\tserver: ComputeServerConfig\n): Promise<SchemaExtractionResult[]> {\n\tconst schemaUrl = new URL('/grasshopper/schema', server.serverUrl).toString();\n\n\tconst headers: Record<string, string> = {};\n\tif (server.apiKey) {\n\t\theaders['RhinoComputeKey'] = server.apiKey;\n\t}\n\n\tlet response: Response;\n\ttry {\n\t\tresponse = await fetch(schemaUrl, { method: 'POST', headers, body: formData });\n\t} catch (err) {\n\t\tthrow new SchemaExtractionError(\n\t\t\t'unreachable',\n\t\t\t`Compute server is unreachable: ${err instanceof Error ? err.message : String(err)}`\n\t\t);\n\t}\n\n\tif (!response.ok) {\n\t\tthrow new SchemaExtractionError(\n\t\t\t'unreachable',\n\t\t\t`Schema endpoint returned ${response.status}: ${response.statusText}`\n\t\t);\n\t}\n\n\t// Normalize here rather than in each caller: the upload/validation route reads\n\t// `postSchemaFormData` directly, so a fix applied only inside\n\t// `fetchSchemaFromCompute` would leave that path serving PascalCase schemas.\n\tconst results = readSchemaResults(await response.json());\n\treturn results.map((result) => ({\n\t\t...result,\n\t\tschemas: result.schemas?.map((schema) => normalizeUISchemaCasing(schema))\n\t}));\n}\n\n/**\n * Throws `SchemaExtractionError` so callers can map to the right HTTP status:\n * 503 unreachable / 422 invalid or unsupported.\n */\nexport async function fetchSchemaFromCompute(\n\tdefinitionBytes: Uint8Array,\n\tserver: ComputeServerConfig\n): Promise<UISchema> {\n\treturn (await fetchExtraction(definitionBytes, server)).schema;\n}\n\n/** A file's schema and, from a plugin that builds one, its inventory. */\nexport interface Extraction {\n\tschema: UISchema;\n\tinventory: DocumentInventory | null;\n}\n\n/** `fetchSchemaFromCompute` with the inventory Compute returns beside the schema. */\nexport async function fetchExtraction(\n\tdefinitionBytes: Uint8Array,\n\tserver: ComputeServerConfig\n): Promise<Extraction> {\n\tconst formData = new FormData();\n\tconst blob = new Blob([new Uint8Array(definitionBytes)], { type: 'application/octet-stream' });\n\tformData.append('file', blob, 'definition.gh');\n\n\tconst results = await postSchemaFormData(formData, server);\n\tconst schemas = results.flatMap((r) => r.schemas ?? []);\n\n\tif (schemas.length === 0) {\n\t\t// Compute answers 200 while reporting a per-file `error`, so the\n\t\t// !response.ok guard never fires for it. Surface that message verbatim: it\n\t\t// names the actual cause (bad Schema source, no embedded schema, ...),\n\t\t// which the generic fallback below cannot.\n\t\tconst diagnosis = results.map((r) => r.error).filter(Boolean);\n\t\tif (diagnosis.length > 0) {\n\t\t\tthrow new SchemaExtractionError('invalid', diagnosis.join('\\n'));\n\t\t}\n\n\t\tthrow new SchemaExtractionError(\n\t\t\t'invalid',\n\t\t\t'No schemas found in definition.\\n\\n' +\n\t\t\t\t'In Grasshopper, verify a Context Bake component with the output name \"Schema\" is present and wired to the solver.'\n\t\t);\n\t}\n\n\tassertSupportedSchemaVersion(schemas[0]);\n\tassertCamelCaseSchema(schemas[0]);\n\tconst inventory = results.find((r) => r.schemas?.length)?.inventory;\n\treturn { schema: schemas[0], inventory: isInventory(inventory) ? inventory : null };\n}\n\n// Shape check only: the plugin built it from the same wire schema. A malformed one is dropped, not\n// fatal, because the schema alone still gates the upload.\nfunction isInventory(value: unknown): value is DocumentInventory {\n\tconst v = value as Partial<DocumentInventory> | null;\n\treturn (\n\t\t!!v &&\n\t\ttypeof v === 'object' &&\n\t\tArray.isArray(v.libraries) &&\n\t\tArray.isArray(v.components) &&\n\t\tArray.isArray(v.values) &&\n\t\tArray.isArray(v.scripts) &&\n\t\ttypeof v.wires?.count === 'number'\n\t);\n}\n\n/**\n * How long an upload waits for the saved values once the schema is in. Missing them costs only\n * the first render its defaults: the render path reads them behind that render.\n */\nconst SAVED_VALUES_GRACE_MS = 5_000;\n\n// Bounds the `/io` request itself, which outlives an upload that stopped waiting for it.\nconst SAVED_VALUES_TIMEOUT_MS = 120_000;\n\n/**\n * `fetchSchemaFromCompute` with the values saved in the file as input defaults, so the stored\n * schema renders without asking Compute again. The values are read beside the schema,\n * best-effort: only the schema gates the upload.\n */\nexport async function extractSchemaForUpload(\n\tdefinitionBytes: Uint8Array,\n\tserver: ComputeServerConfig\n): Promise<Extraction> {\n\tconst values = fetchParsedDefinitionIO(definitionBytes, {\n\t\tserverUrl: server.serverUrl,\n\t\t...(server.apiKey && { apiKey: server.apiKey }),\n\t\ttimeoutMs: SAVED_VALUES_TIMEOUT_MS\n\t}).then((io) => savedValuesFrom(io.inputs));\n\tvalues.catch(() => {});\n\n\tconst { schema, inventory } = await fetchExtraction(definitionBytes, server);\n\tconst saved = await withTimeout(\n\t\tvalues,\n\t\tSAVED_VALUES_GRACE_MS,\n\t\t() => new Error('saved values not read in time')\n\t).catch(() => null);\n\treturn { schema: saved ? applySavedValues(schema, saved) : schema, inventory };\n}\n\n/**\n * The source of the named script components, read by Compute from a stored file. The inventory\n * keeps fingerprints only, so this is how a code diff gets the code. Throws 'unsupported' when the\n * server's plugin cannot read scripts.\n */\nexport async function fetchScriptSources(\n\tdefinitionBytes: Uint8Array,\n\tids: readonly string[],\n\tserver: ComputeServerConfig\n): Promise<ScriptSource[]> {\n\tconst form = new FormData();\n\tform.append('file', new Blob([new Uint8Array(definitionBytes)]), 'definition.gh');\n\tform.append('ids', ids.join(','));\n\tconst headers: Record<string, string> = {};\n\tif (server.apiKey) headers['RhinoComputeKey'] = server.apiKey;\n\n\tlet response: Response;\n\ttry {\n\t\tresponse = await fetch(new URL('/grasshopper/scripts', server.serverUrl), {\n\t\t\tmethod: 'POST',\n\t\t\theaders,\n\t\t\tbody: form\n\t\t});\n\t} catch (err) {\n\t\tthrow new SchemaExtractionError(\n\t\t\t'unreachable',\n\t\t\t`Compute server is unreachable: ${err instanceof Error ? err.message : String(err)}`\n\t\t);\n\t}\n\t// A server without the endpoint answers 404; one whose plugin predates it, 422.\n\tif (response.status === 404 || response.status === 422) {\n\t\tthrow new SchemaExtractionError(\n\t\t\t'unsupported',\n\t\t\t'This Compute server cannot read script source. Update the server and its Selva plugin.'\n\t\t);\n\t}\n\tif (!response.ok) {\n\t\tthrow new SchemaExtractionError(\n\t\t\t'unreachable',\n\t\t\t`Scripts endpoint returned ${response.status}: ${response.statusText}`\n\t\t);\n\t}\n\tconst body = (await response.json()) as ScriptSource[];\n\treturn Array.isArray(body) ? body : [];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAeA,IAAa,iCAAb,cAAoD,MAAM;CACzD,YACC,UAAU,4EACT;EACD,MAAM,OAAO;EACb,KAAK,OAAO;CACb;AACD;;ACbA,SAAgB,gBACf,QACc;CACd,MAAM,yBAAS,IAA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AAM,IAAI,IAAI,wBAAwB,OAAO,SAAS,GAAG;GACzE,QAAQ;GACR;GACA,MAAM;EACP,CAAC;CACF,SAAS,KAAK;EACb,MAAM,IAAI,sBACT,eACA,kCAAkC,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG,GAClF;CACD;CAEA,IAAI,SAAS,WAAW,OAAO,SAAS,WAAW,KAClD,MAAM,IAAI,sBACT,eACA,wFACD;CAED,IAAI,CAAC,SAAS,IACb,MAAM,IAAI,sBACT,eACA,6BAA6B,SAAS,OAAO,IAAI,SAAS,YAC3D;CAED,MAAM,OAAQ,MAAM,SAAS,KAAK;CAClC,OAAO,MAAM,QAAQ,IAAI,IAAI,OAAO,CAAC;AACtC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"visibility.js","names":[],"sources":["../../../../platform/src/pagination.ts","../../../../server/src/definitions/visibility.ts"],"sourcesContent":["/**\n * Cursor-paginated list options. Adapters default `limit` to `DEFAULT_PAGE_LIMIT` and\n * clamp it to `MAX_PAGE_LIMIT` (`clampPageLimit`). Order is `createdAt` desc unless the\n * store documents another; a store with one fixed order may ignore `orderBy`.\n *\n * Cursors are opaque — adapters may use row ids, offsets, or keyset encodings.\n * Callers must not inspect them.\n */\nexport interface ListOptions {\n\tlimit?: number;\n\tcursor?: string;\n\torderBy?: 'createdAt' | 'updatedAt' | 'name';\n\t/** Default: 'desc'. */\n\torderDir?: 'asc' | 'desc';\n}\n\nexport interface Page<T> {\n\titems: T[];\n\tnextCursor?: string;\n}\n\nexport const DEFAULT_PAGE_LIMIT = 50;\nexport const MAX_PAGE_LIMIT = 200;\n\n/** For adapters paging by offset. Junk and negatives read as the first page. */\nexport function decodeOffsetCursor(cursor: string | undefined): number {\n\tconst offset = cursor ? parseInt(cursor, 10) : 0;\n\treturn Number.isFinite(offset) && offset >= 0 ? offset : 0;\n}\n\nexport function encodeOffsetCursor(offset: number): string {\n\treturn String(offset);\n}\n\ntype PageFetcher<T> = (page: { limit: number; cursor?: string }) => Promise<Page<T>>;\n\n/**\n * Every page of a list, in order. One call stops at `MAX_PAGE_LIMIT` without saying so, which is\n * fatal for a read that must see every row. Break out of the loop to stop reading.\n */\nexport async function* walkPages<T>(fetchPage: PageFetcher<T>): AsyncGenerator<Page<T>> {\n\tlet cursor: string | undefined;\n\tdo {\n\t\tconst page = await fetchPage({ limit: MAX_PAGE_LIMIT, cursor });\n\t\tyield page;\n\t\tcursor = page.nextCursor;\n\t} while (cursor);\n}\n\n/** Every row of a list, across all its pages. */\nexport async function listAll<T>(fetchPage: PageFetcher<T>): Promise<T[]> {\n\tconst items: T[] = [];\n\tfor await (const page of walkPages(fetchPage)) items.push(...page.items);\n\treturn items;\n}\n\n/** The effective page size for a requested limit. */\nexport function clampPageLimit(limit: number | undefined): number {\n\tconst requested = limit ?? DEFAULT_PAGE_LIMIT;\n\tif (!Number.isFinite(requested)) return DEFAULT_PAGE_LIMIT;\n\treturn Math.min(Math.max(1, Math.floor(requested)), MAX_PAGE_LIMIT);\n}\n","/**\n * Visibility-filtered definition reads, shared by the library page load and\n * `GET /api/v1/definitions`.\n *\n * **This is a tenancy boundary.** The project scan runs as `SYSTEM_CONTEXT` so\n * cross-org `public` projects are reachable when `ALLOW_CROSS_ORG_PUBLIC` is on;\n * `canView` over the fetched membership rows is the only thing keeping another\n * org's projects out of the result. The definition list itself is then filtered\n * *in the query* via `projectIds`, so the cursor is applied after visibility\n * rather than over a page that gets thinned afterwards.\n *\n * Cost is constant in the number of orgs and projects: three bulk membership\n * reads regardless of N. Anything added here must keep that property — a\n * per-project `await` inside a loop reintroduces the N+1 this replaced.\n */\n\nimport {\n\tSYSTEM_CONTEXT,\n\tcanCreateDefinition,\n\tcanEditDefinition,\n\tcanView,\n\toutsideTokenOrg,\n\tscopeAllows,\n\twalkPages\n} from '@selvajs/platform';\nimport type {\n\tDefinitionListOptions,\n\tDefinitionRecord,\n\tDefinitionVersion,\n\tOrgMember,\n\tPage,\n\tPlatformProjectGrant,\n\tProject,\n\tProjectMember,\n\tRequestContext\n} from '@selvajs/platform';\nimport { projectAccessInputFromRowsWith } from '../access/index.js';\nimport type { SelvaDeps } from '../api/deps.js';\n\n/** Upper bound on the org/project scan. Visibility needs the whole set. */\nconst SCAN_LIMIT = 200;\n\n/**\n * The stores this module reads. Required at every call site.\n *\n * These used to fall back to a host's composition root, which welded this\n * tenancy boundary to one app's boot — anything importing it started the whole\n * application. Handlers pass `req.deps`; page loads pass their own equivalent.\n * That is what lets a second host on a different provider set reuse this\n * boundary instead of rebuilding it.\n */\nexport type VisibilityDeps = Pick<\n\tSelvaDeps,\n\t'orgs' | 'projects' | 'platformProjectGrants' | 'definitionMeta' | 'flag'\n>;\n\n/**\n * The caller's accessible project set plus the membership rows it was derived\n * from, so a caller needing a second rule (`canEdit` on the projects page)\n * can evaluate it with no further I/O.\n */\nexport interface AccessibleProjectSet {\n\tprojects: Project[];\n\t/** Every project the scan saw, keyed by id — for name lookups on rows. */\n\tallById: Map<string, Project>;\n\t/** The caller's project-membership row per scanned project (`null` = not a member). */\n\tmemberByProjectId: Map<string, ProjectMember | null>;\n\t/** The caller's org-membership row per scanned org (`null` = not a member). */\n\torgMemberByOrgId: Map<string, OrgMember | null>;\n\t/** Grants per scanned `platform` project; absent for every other visibility. */\n\tgrantsByProjectId: Map<string, PlatformProjectGrant[]>;\n}\n\n/**\n * Resolve the caller's accessible project set in a constant number of queries.\n * Platform grants are fetched only for `platform`-visibility projects —\n * `canView` short-circuits before reading them for every other visibility.\n */\nexport async function resolveAccessibleProjects(\n\tctx: RequestContext,\n\tdeps: VisibilityDeps\n): Promise<AccessibleProjectSet> {\n\tconst orgs = deps.orgs;\n\tconst projectStore = deps.projects;\n\tconst grantStore = deps.platformProjectGrants;\n\n\tconst orgsPage = await orgs.listOrgs(SYSTEM_CONTEXT, { limit: SCAN_LIMIT });\n\t// An API token sees its own org only, cross-org public projects included.\n\tconst orgIds = orgsPage.items.map((o) => o.id).filter((id) => !outsideTokenOrg(ctx, id));\n\n\tconst projectPages = await Promise.all(\n\t\torgIds.map((orgId) => projectStore.listProjects(SYSTEM_CONTEXT, orgId, { limit: SCAN_LIMIT }))\n\t);\n\tconst allProjects = projectPages.flatMap((p) => p.items);\n\tconst projectIds = allProjects.map((p) => p.id);\n\tconst platformProjectIds = allProjects\n\t\t.filter((p) => p.visibility === 'platform')\n\t\t.map((p) => p.id);\n\n\tconst [orgMemberByOrgId, memberByProjectId, grantsByProjectId] = await Promise.all([\n\t\torgs.getOrgMembersFor(SYSTEM_CONTEXT, orgIds, ctx.userId),\n\t\tprojectStore.getProjectMembersFor(SYSTEM_CONTEXT, projectIds, ctx.userId),\n\t\tplatformProjectIds.length\n\t\t\t? grantStore.listByProjects(SYSTEM_CONTEXT, platformProjectIds)\n\t\t\t: Promise.resolve(new Map<string, PlatformProjectGrant[]>())\n\t]);\n\n\tconst projects = allProjects.filter((project) =>\n\t\tcanView(\n\t\t\tprojectAccessInputFromRowsWith({ deps }, ctx, project, {\n\t\t\t\tmember: memberByProjectId.get(project.id) ?? null,\n\t\t\t\torgMember: orgMemberByOrgId.get(project.orgId) ?? null,\n\t\t\t\tplatformGrants: grantsByProjectId.get(project.id) ?? []\n\t\t\t})\n\t\t)\n\t);\n\n\treturn {\n\t\tprojects,\n\t\tallById: new Map(allProjects.map((p) => [p.id, p])),\n\t\tmemberByProjectId,\n\t\torgMemberByOrgId,\n\t\tgrantsByProjectId\n\t};\n}\n\n/**\n * Whether the caller may create a definition in at least one project of\n * `orgId`, by the same rule `requireCanCreateDefinition` applies. Reads the\n * org's projects a page at a time and stops at the first that passes.\n */\nexport async function canCreateDefinitionInOrg(\n\tctx: RequestContext,\n\torgId: string,\n\tdeps: VisibilityDeps\n): Promise<boolean> {\n\tconst orgMember =\n\t\t(await deps.orgs.getOrgMembersFor(SYSTEM_CONTEXT, [orgId], ctx.userId)).get(orgId) ?? null;\n\tconst pages = walkPages((page) => deps.projects.listProjects(SYSTEM_CONTEXT, orgId, page));\n\tfor await (const page of pages) {\n\t\tconst platformIds = page.items.filter((p) => p.visibility === 'platform').map((p) => p.id);\n\t\tconst [members, grants] = await Promise.all([\n\t\t\tdeps.projects.getProjectMembersFor(\n\t\t\t\tSYSTEM_CONTEXT,\n\t\t\t\tpage.items.map((p) => p.id),\n\t\t\t\tctx.userId\n\t\t\t),\n\t\t\tplatformIds.length\n\t\t\t\t? deps.platformProjectGrants.listByProjects(SYSTEM_CONTEXT, platformIds)\n\t\t\t\t: Promise.resolve(new Map<string, PlatformProjectGrant[]>())\n\t\t]);\n\t\tconst allowed = page.items.some((project) =>\n\t\t\tcanCreateDefinition(\n\t\t\t\tprojectAccessInputFromRowsWith({ deps }, ctx, project, {\n\t\t\t\t\tmember: members.get(project.id) ?? null,\n\t\t\t\t\torgMember,\n\t\t\t\t\tplatformGrants: grants.get(project.id) ?? []\n\t\t\t\t})\n\t\t\t)\n\t\t);\n\t\tif (allowed) return true;\n\t}\n\treturn false;\n}\n\nexport interface ListVisibleDefinitionsResult extends Page<DefinitionRecord> {\n\t/** For resolving a definition's `projectId` to a name. */\n\tprojects: Project[];\n}\n\n/**\n * `opts.projectId` narrows to one project; a caller who cannot view it gets an\n * empty page rather than a 403, so this never reveals that a project exists.\n */\nexport async function listVisibleDefinitions(\n\tctx: RequestContext,\n\topts: DefinitionListOptions & { projectId?: string } = {},\n\tdeps: VisibilityDeps\n): Promise<ListVisibleDefinitionsResult> {\n\tconst { projectId, ...listOpts } = opts;\n\tconst { projects } = await resolveAccessibleProjects(ctx, deps);\n\n\tconst scoped = projectId ? projects.filter((p) => p.id === projectId) : projects;\n\t// An empty id set matches nothing, which is what a caller with no visible\n\t// projects should get — not an unfiltered listing.\n\tconst page = await deps.definitionMeta.list(ctx, {\n\t\t...listOpts,\n\t\tprojectIds: scoped.map((p) => p.id)\n\t});\n\n\treturn { items: page.items, nextCursor: page.nextCursor, projects: scoped };\n}\n\n/**\n * Editable definitions whose `sourceDocumentId` is `documentId`: the ones the\n * caller could upload a new version of, by {@link mayUploadToDefinition}.\n *\n * Commons projects are scanned too, since a caller owns their own uploads there\n * without edit rights on the project; rows they can't edit are dropped after\n * the query, so a page can come back short while `nextCursor` stays valid.\n */\nexport async function listEditableDefinitionsByDocument(\n\tctx: RequestContext,\n\tdocumentId: string,\n\topts: DefinitionListOptions & { projectId?: string },\n\tdeps: VisibilityDeps\n): Promise<Page<DefinitionRecord>> {\n\tconst { projectId, ...listOpts } = opts;\n\tconst set = await resolveAccessibleProjects(ctx, deps);\n\tconst rowsFor = (project: Project) => ({\n\t\tmember: set.memberByProjectId.get(project.id) ?? null,\n\t\torgMember: set.orgMemberByOrgId.get(project.orgId) ?? null,\n\t\tplatformGrants: set.grantsByProjectId.get(project.id) ?? []\n\t});\n\tconst candidates = set.projects.filter(\n\t\t(p) =>\n\t\t\t(!projectId || p.id === projectId) &&\n\t\t\tcanCreateDefinition(projectAccessInputFromRowsWith({ deps }, ctx, p, rowsFor(p)))\n\t);\n\n\tconst page = await deps.definitionMeta.list(ctx, {\n\t\t...listOpts,\n\t\tsourceDocumentId: documentId,\n\t\tprojectIds: candidates.map((p) => p.id)\n\t});\n\tconst items = page.items.filter((record) => {\n\t\tconst project = set.allById.get(record.projectId);\n\t\treturn project\n\t\t\t? mayUploadToDefinition(ctx, { record, project, ...rowsFor(project) }, deps)\n\t\t\t: false;\n\t});\n\treturn { items, nextCursor: page.nextCursor };\n}\n\n/** A visible definition and the caller's rows that decided it. */\nexport interface VisibleDefinition {\n\trecord: DefinitionRecord;\n\tproject: Project;\n\tmember: ProjectMember | null;\n\torgMember: OrgMember | null;\n}\n\n/**\n * One definition, or `null` when the caller cannot view its project.\n *\n * Returns `null` rather than throwing 403 so callers surface a 404: a public\n * API that answers \"forbidden\" for a guid the caller cannot see turns\n * `/definitions/{guid}` into a cross-tenant existence oracle.\n */\nexport async function getVisibleDefinition(\n\tctx: RequestContext,\n\tguid: string,\n\tdeps: VisibilityDeps\n): Promise<DefinitionRecord | null> {\n\treturn (await loadVisibleDefinition(ctx, guid, deps))?.record ?? null;\n}\n\n/** {@link getVisibleDefinition} with the rows it read, for a second rule over the same caller. */\nexport async function loadVisibleDefinition(\n\tctx: RequestContext,\n\tguid: string,\n\tdeps: VisibilityDeps\n): Promise<VisibleDefinition | null> {\n\tconst meta = deps.definitionMeta;\n\tconst projectStore = deps.projects;\n\n\tconst record = await meta.get(ctx, guid);\n\tif (!record) return null;\n\n\tconst project = await projectStore.getProject(SYSTEM_CONTEXT, record.projectId);\n\tif (!project || outsideTokenOrg(ctx, project.orgId)) return null;\n\n\tconst [orgMembers, projectMembers, grants] = await Promise.all([\n\t\tdeps.orgs.getOrgMembersFor(SYSTEM_CONTEXT, [project.orgId], ctx.userId),\n\t\tprojectStore.getProjectMembersFor(SYSTEM_CONTEXT, [project.id], ctx.userId),\n\t\tproject.visibility === 'platform'\n\t\t\t? deps.platformProjectGrants.listByProject(SYSTEM_CONTEXT, project.id)\n\t\t\t: Promise.resolve([] as PlatformProjectGrant[])\n\t]);\n\n\tconst member = projectMembers.get(project.id) ?? null;\n\tconst orgMember = orgMembers.get(project.orgId) ?? null;\n\tconst allowed = canView(\n\t\tprojectAccessInputFromRowsWith({ deps }, ctx, project, {\n\t\t\tmember,\n\t\t\torgMember,\n\t\t\tplatformGrants: grants\n\t\t})\n\t);\n\treturn allowed ? { record, project, member, orgMember } : null;\n}\n\n/**\n * May the caller upload a version of this definition and make one live? The\n * rule `requireEditableDefinition` applies, and for an API token its `upload`\n * scope on the definition, which is what those routes check.\n */\nexport function mayUploadToDefinition(\n\tctx: RequestContext,\n\t{ record, project, member, orgMember }: VisibleDefinition,\n\tdeps: Pick<VisibilityDeps, 'flag'>\n): boolean {\n\treturn (\n\t\tscopeAllows(ctx, 'upload', { definitionId: record.guid, projectId: project.id }) &&\n\t\tcanEditDefinition({\n\t\t\tproject,\n\t\t\tdefinition: record,\n\t\t\tmember,\n\t\t\torgMember,\n\t\t\tuserId: ctx.userId,\n\t\t\tplatformPermissions: ctx.platformPermissions,\n\t\t\tenablePlatformProjects: deps.flag('ENABLE_PLATFORM_PROJECTS')\n\t\t})\n\t);\n}\n\n/**\n * One version of a definition the caller can view, including its cached\n * `schema`. `null` when the definition is invisible, the version is missing, or\n * the version belongs to a different definition — a caller must not be able to\n * read an arbitrary version by pairing it with a guid they can see.\n */\nexport async function loadVisibleVersion(\n\tctx: RequestContext,\n\tguid: string,\n\tversionId: string,\n\tdeps: VisibilityDeps\n): Promise<DefinitionVersion | null> {\n\tconst record = await getVisibleDefinition(ctx, guid, deps);\n\tif (!record) return null;\n\n\tconst version = await deps.definitionMeta.getVersion(ctx, versionId);\n\tif (!version || version.definitionId !== record.guid) return null;\n\treturn version;\n}\n"],"mappings":";;;AAyBA,SAAgB,mBAAmB,QAAoC;CACtE,MAAM,SAAS,SAAS,SAAS,QAAQ,EAAE,IAAI;CAC/C,OAAO,OAAO,SAAS,MAAM,KAAK,UAAU,IAAI,SAAS;AAC1D;AAEA,SAAgB,mBAAmB,QAAwB;CAC1D,OAAO,OAAO,MAAM;AACrB;;;;;AAQA,gBAAuB,UAAa,WAAoD;CACvF,IAAI;CACJ,GAAG;EACF,MAAM,OAAO,MAAM,UAAU;GAAE,OAAA;GAAuB;EAAO,CAAC;EAC9D,MAAM;EACN,SAAS,KAAK;CACf,SAAS;AACV;;AAGA,eAAsB,QAAW,WAAyC;CACzE,MAAM,QAAa,CAAC;CACpB,WAAW,MAAM,QAAQ,UAAU,SAAS,GAAG,MAAM,KAAK,GAAG,KAAK,KAAK;CACvE,OAAO;AACR;;AAGA,SAAgB,eAAe,OAAmC;CACjE,MAAM,YAAY,SAAA;CAClB,IAAI,CAAC,OAAO,SAAS,SAAS,GAAG,OAAA;CACjC,OAAO,KAAK,IAAI,KAAK,IAAI,GAAG,KAAK,MAAM,SAAS,CAAC,GAAA,GAAiB;AACnE;;;;;;;;;;;;;;;;;;ACrBA,IAAM,aAAa;;;;;;AAsCnB,eAAsB,0BACrB,KACA,MACgC;CAChC,MAAM,OAAO,KAAK;CAClB,MAAM,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